fix stream helper spec for new rspec
This commit is contained in:
parent
01ecd9d054
commit
525cd4cc02
1 changed files with 19 additions and 14 deletions
|
|
@ -6,24 +6,29 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe StreamHelper do
|
describe StreamHelper do
|
||||||
describe "next_page_path" do
|
describe "next_page_path" do
|
||||||
|
def build_controller controller_class
|
||||||
|
controller_class.new.tap {|c| c.request = controller.request }
|
||||||
|
end
|
||||||
before do
|
before do
|
||||||
@stream = Stream::Base.new(alice, :max_time => Time.now)
|
@stream = Stream::Base.new(alice, :max_time => Time.now)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'works for public page' do
|
it 'works for public page' do
|
||||||
stub(:controller).and_return(PostsController.new)
|
helper.stub(:controller).and_return(build_controller(PostsController))
|
||||||
next_page_path.should include '/public'
|
helper.next_page_path.should include '/public'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'works for stream page when current page is stream' do
|
it 'works for stream page when current page is stream' do
|
||||||
self.stub("current_page?").and_return(true)
|
helper.stub(:current_page?).and_return(true)
|
||||||
stub(:controller).and_return(StreamsController.new)
|
helper.stub(:controller).and_return(build_controller(StreamsController))
|
||||||
next_page_path.should include stream_path
|
helper.next_page_path.should include stream_path
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'works for activity page when current page is not stream' do
|
it 'works for activity page when current page is not stream' do
|
||||||
self.stub("current_page?").and_return(false)
|
helper.stub("current_page?").and_return(false)
|
||||||
stub(:controller).and_return(StreamsController.new)
|
helper.stub(:controller).and_return(build_controller(StreamsController))
|
||||||
next_page_path.should include activity_stream_path
|
# binding.pry
|
||||||
|
helper.next_page_path.should include activity_stream_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue