Change naming convention for presenter objects
This commit is contained in:
parent
463f18c207
commit
105d11bfe7
@ -10,7 +10,7 @@ class AsciicastsController < ApplicationController
|
||||
|
||||
def index
|
||||
render locals: {
|
||||
page: AsciicastListPresenter.build(params[:category], params[:order],
|
||||
page: BrowsePagePresenter.build(params[:category], params[:order],
|
||||
params[:page])
|
||||
}
|
||||
end
|
||||
@ -20,7 +20,7 @@ class AsciicastsController < ApplicationController
|
||||
format.html do
|
||||
view_counter.increment(asciicast, cookies)
|
||||
render locals: {
|
||||
page: AsciicastPresenter.build(asciicast, current_user, params)
|
||||
page: AsciicastPagePresenter.build(asciicast, current_user, params)
|
||||
}
|
||||
end
|
||||
|
||||
@ -36,7 +36,7 @@ class AsciicastsController < ApplicationController
|
||||
|
||||
def bare
|
||||
response.headers.delete('X-Frame-Options')
|
||||
render locals: { page: BareAsciicastPresenter.build(asciicast, params) },
|
||||
render locals: { page: BareAsciicastPagePresenter.build(asciicast, params) },
|
||||
layout: 'bare'
|
||||
end
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
class HomeController < ApplicationController
|
||||
|
||||
def show
|
||||
render locals: { page: HomePresenter.new }
|
||||
render locals: { page: HomePagePresenter.new }
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ class UsersController < ApplicationController
|
||||
|
||||
def show
|
||||
user = User.find_by_nickname!(params[:nickname])
|
||||
render locals: { page: UserPresenter.build(user, current_user) }
|
||||
render locals: { page: UserPagePresenter.build(user, current_user) }
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -1,4 +1,4 @@
|
||||
class AsciicastPresenter
|
||||
class AsciicastPagePresenter
|
||||
|
||||
attr_reader :asciicast, :current_user, :playback_options
|
||||
|
@ -1,4 +1,4 @@
|
||||
class BareAsciicastPresenter
|
||||
class BareAsciicastPagePresenter
|
||||
|
||||
attr_reader :asciicast, :playback_options
|
||||
|
@ -1,4 +1,4 @@
|
||||
class AsciicastListPresenter
|
||||
class BrowsePagePresenter
|
||||
|
||||
DEFAULT_CATEGORY = :all
|
||||
DEFAULT_ORDER = :recency
|
@ -1,4 +1,4 @@
|
||||
class HomePresenter
|
||||
class HomePagePresenter
|
||||
|
||||
attr_reader :playback_options
|
||||
|
@ -1,4 +1,4 @@
|
||||
class UserPresenter
|
||||
class UserPagePresenter
|
||||
|
||||
PER_PAGE = 15
|
||||
|
@ -22,7 +22,7 @@ describe AsciicastsController do
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:render)
|
||||
allow(AsciicastListPresenter).to receive(:build).
|
||||
allow(BrowsePagePresenter).to receive(:build).
|
||||
with('featured', 'recency', '2') { asciicast_list_presenter }
|
||||
|
||||
get :index, category: 'featured', order: 'recency', page: '2'
|
||||
@ -30,7 +30,7 @@ describe AsciicastsController do
|
||||
|
||||
it { should be_success }
|
||||
|
||||
it "renders template with AsciicastListPresenter as page" do
|
||||
it "renders template with BrowsePagePresenter as page" do
|
||||
expect(controller).to have_received(:render).
|
||||
with(locals: { page: asciicast_list_presenter })
|
||||
end
|
||||
@ -52,7 +52,7 @@ describe AsciicastsController do
|
||||
before do
|
||||
allow(controller).to receive(:render)
|
||||
allow(controller).to receive(:current_user) { user }
|
||||
allow(AsciicastPresenter).to receive(:build).
|
||||
allow(AsciicastPagePresenter).to receive(:build).
|
||||
with(asciicast, user, hash_including('speed' => '3.0')).
|
||||
and_return(asciicast_presenter)
|
||||
|
||||
@ -66,7 +66,7 @@ describe AsciicastsController do
|
||||
with(asciicast, cookies)
|
||||
end
|
||||
|
||||
it "renders template with AsciicastPresenter as page" do
|
||||
it "renders template with AsciicastPagePresenter as page" do
|
||||
expect(controller).to have_received(:render).
|
||||
with(locals: { page: asciicast_presenter })
|
||||
end
|
||||
|
@ -8,9 +8,9 @@ describe HomeController do
|
||||
get :show
|
||||
end
|
||||
|
||||
it "renders template with HomePresenter as page" do
|
||||
it "renders template with HomePagePresenter as page" do
|
||||
expect(controller).to have_received(:render).
|
||||
with(locals: { page: kind_of(HomePresenter) })
|
||||
with(locals: { page: kind_of(HomePagePresenter) })
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe AsciicastPresenter do
|
||||
describe AsciicastPagePresenter do
|
||||
|
||||
describe '.build' do
|
||||
subject { described_class.build(asciicast, user, playback_options) }
|
@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe BareAsciicastPresenter do
|
||||
describe BareAsciicastPagePresenter do
|
||||
|
||||
describe '.build' do
|
||||
subject { described_class.build(asciicast, playback_options) }
|
@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe AsciicastListPresenter do
|
||||
describe BrowsePagePresenter do
|
||||
|
||||
describe '.build' do
|
||||
subject { described_class.build(category, order, page, per_page) }
|
@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe HomePresenter do
|
||||
describe HomePagePresenter do
|
||||
|
||||
let(:presenter) { described_class.new }
|
||||
|
@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe UserPresenter do
|
||||
describe UserPagePresenter do
|
||||
|
||||
describe '.build' do
|
||||
subject { described_class.build(user, current_user, page, per_page) }
|
Loading…
Reference in New Issue
Block a user