diff --git a/spec/helpers/stream_helper_spec.rb b/spec/helpers/stream_helper_spec.rb index 0606fe052..df4520222 100644 --- a/spec/helpers/stream_helper_spec.rb +++ b/spec/helpers/stream_helper_spec.rb @@ -6,24 +6,29 @@ require 'spec_helper' describe StreamHelper do describe "next_page_path" do + def build_controller controller_class + controller_class.new.tap {|c| c.request = controller.request } + end before do @stream = Stream::Base.new(alice, :max_time => Time.now) end - it 'works for public page' do - stub(:controller).and_return(PostsController.new) - next_page_path.should include '/public' - end - it 'works for stream page when current page is stream' do - self.stub("current_page?").and_return(true) - stub(:controller).and_return(StreamsController.new) - next_page_path.should include stream_path - end + it 'works for public page' do + helper.stub(:controller).and_return(build_controller(PostsController)) + helper.next_page_path.should include '/public' + end - it 'works for activity page when current page is not stream' do - self.stub("current_page?").and_return(false) - stub(:controller).and_return(StreamsController.new) - next_page_path.should include activity_stream_path - end + it 'works for stream page when current page is stream' do + helper.stub(:current_page?).and_return(true) + helper.stub(:controller).and_return(build_controller(StreamsController)) + helper.next_page_path.should include stream_path + end + + it 'works for activity page when current page is not stream' do + helper.stub("current_page?").and_return(false) + helper.stub(:controller).and_return(build_controller(StreamsController)) + # binding.pry + helper.next_page_path.should include activity_stream_path + end end end