remove #next_post_path and #previous_post_path from postpresenter

This commit is contained in:
Fabian Rodriguez 2013-12-01 16:54:05 -02:00
parent 92db8cb929
commit d7b8cb2997
2 changed files with 6 additions and 27 deletions

View file

@ -35,8 +35,6 @@ class PostPresenter
:frame_name => @post.frame_name || template_name,
:root => root,
:title => title,
:next_post => next_post_path,
:previous_post => previous_post_path,
:address => @post.address,
:interactions => {
@ -49,14 +47,6 @@ class PostPresenter
}
end
def next_post_path
Rails.application.routes.url_helpers.next_post_path(@post)
end
def previous_post_path
Rails.application.routes.url_helpers.previous_post_path(@post)
end
def title
@post.text.present? ? post_page_title(@post) : I18n.translate('posts.presenter.title', :name => @post.author_name)
end

View file

@ -63,18 +63,6 @@ describe PostPresenter do
end
end
describe '#next_post_path' do
it 'returns a string of the users next post' do
@presenter.next_post_path.should == "#{Rails.application.routes.url_helpers.post_path(@sm)}/next"
end
end
describe '#previous_post_path' do
it 'returns a string of the users next post' do
@presenter.previous_post_path.should == "#{Rails.application.routes.url_helpers.post_path(@sm)}/previous"
end
end
describe '#title' do
context 'with posts with text' do
context 'with a Markdown header of less than 200 characters on first line'do
@ -90,6 +78,7 @@ describe PostPresenter do
@presenter.title.should == "My title \n======"
end
end
context 'without a Markdown header of less than 200 characters on first line 'do
it 'truncates post to the 20 first characters' do
@sm = stub(:text => "Very, very, very long post")
@ -98,9 +87,9 @@ describe PostPresenter do
end
end
end
context 'with posts without text' do
it ' displays a messaage with the post class' do
@sm = stub(:text => "", :author => bob.person, :author_name => bob.person.name)
@presenter.post = @sm
@presenter.title.should == "A post from #{@sm.author.name}"