diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 1d7dad7df..affb08f15 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -7,7 +7,7 @@ class PostsController < ApplicationController before_filter :authenticate_user!, :except => [:show, :iframe, :oembed, :interactions] before_filter :set_format_if_malformed_from_status_net, :only => :show - before_filter :find_post, :only => [:show, :next, :previous, :interactions] + before_filter :find_post, :only => [:show, :interactions] before_filter -> { @css_framework = :bootstrap } @@ -48,24 +48,6 @@ class PostsController < ApplicationController end end - def next - next_post = Post.visible_from_author(@post.author, current_user).newer(@post) - - respond_to do |format| - format.html{ redirect_to post_path(next_post) } - format.json{ render :json => PostPresenter.new(next_post, current_user)} - end - end - - def previous - previous_post = Post.visible_from_author(@post.author, current_user).older(@post) - - respond_to do |format| - format.html{ redirect_to post_path(previous_post) } - format.json{ render :json => PostPresenter.new(previous_post, current_user)} - end - end - def interactions respond_with(PostInteractionPresenter.new(@post, current_user)) end diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb index 691d37c8d..20b2d8a1c 100644 --- a/spec/controllers/posts_controller_spec.rb +++ b/spec/controllers/posts_controller_spec.rb @@ -167,58 +167,4 @@ describe PostsController do StatusMessage.exists?(message.id).should be_true end end - - describe "#next" do - before do - sign_in alice - Post.stub(:find_by_guid_or_id_with_user).and_return(mock_model(Post, :author => 4)) - Post.stub_chain(:visible_from_author, :newer).and_return(next_post) - end - - let(:next_post){ mock_model(StatusMessage, :id => 34)} - - context "GET .json" do - let(:mock_presenter) { mock(:as_json => {:title => "the unbearable lightness of being"}) } - - it "should return a show presenter the next post" do - PostPresenter.should_receive(:new).with(next_post, alice).and_return(mock_presenter) - get :next, :id => 14, :format => :json - response.body.should == {:title => "the unbearable lightness of being"}.to_json - end - end - - context "GET .html" do - it "should redirect to the next post" do - get :next, :id => 14 - response.should redirect_to(post_path(next_post)) - end - end - end - - describe "previous" do - before do - sign_in alice - Post.stub(:find_by_guid_or_id_with_user).and_return(mock_model(Post, :author => 4)) - Post.stub_chain(:visible_from_author, :older).and_return(previous_post) - end - - let(:previous_post){ mock_model(StatusMessage, :id => 11)} - - context "GET .json" do - let(:mock_presenter) { mock(:as_json => {:title => "existential crises"})} - - it "should return a show presenter the next post" do - PostPresenter.should_receive(:new).with(previous_post, alice).and_return(mock_presenter) - get :previous, :id => 14, :format => :json - response.body.should == {:title => "existential crises"}.to_json - end - end - - context "GET .html" do - it "should redirect to the next post" do - get :previous, :id => 14 - response.should redirect_to(post_path(previous_post)) - end - end - end end