Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix specs.

  • Loading branch information...
commit 74e58ac2d7a2223cefe104432a501d98716be830 1 parent 92cfee9
@strcmp strcmp authored
Showing with 29 additions and 21 deletions.
  1. +29 −21 spec/view_helpers/action_view_spec.rb
View
50 spec/view_helpers/action_view_spec.rb
@@ -42,34 +42,42 @@ def render(locals)
end
- it "should default to LinkRenderer when pagination_options[:renderer] is nil" do
- expectation = { :renderer => WillPaginate::ActionView::LinkRenderer }
- WillPaginate::ViewHelpers.pagination_options.stubs(:merge).with(expectation).returns(expectation)
-
- view = ActionView::Base.new([], @assigns, @controller)
- view.will_paginate WillPaginate::Collection.new(1, 1, 0), {}
+ describe "Renderer" do
+ after(:each) do
+ WillPaginate::ViewHelpers.pagination_options.clear
+ end
- WillPaginate::ViewHelpers.pagination_options.unstub(:merge)
- end
+ it "should default to LinkRenderer when pagination_options[:renderer] is nil" do
+ expectation = { :renderer => WillPaginate::ActionView::LinkRenderer }
+ WillPaginate::ViewHelpers.pagination_options.stubs(:merge).with(expectation).returns(expectation)
+
+ view = ActionView::Base.new([], @assigns, @controller)
+ view.will_paginate WillPaginate::Collection.new(1, 1, 0), {}
+
+ WillPaginate::ViewHelpers.pagination_options.unstub(:merge)
+ end
- it "should default to pagination_options[:renderer] when it is not nil" do
- expectation = { :renderer => "CustomRenderer" }
- WillPaginate::ViewHelpers.pagination_options.stubs(:merge).with(expectation).returns(expectation)
+ it "should default to pagination_options[:renderer] when it is not nil" do
+ expectation = { :renderer => "CustomRenderer" }
- view = ActionView::Base.new([], @assigns, @controller)
- view.will_paginate WillPaginate::Collection.new(1, 1, 0), {}
+ WillPaginate::ViewHelpers.pagination_options[:renderer] = "CustomRenderer"
+ WillPaginate::ViewHelpers.pagination_options.stubs(:merge).with(expectation).returns(expectation)
- WillPaginate::ViewHelpers.pagination_options.unstub(:merge)
- end
+ view = ActionView::Base.new([], @assigns, @controller)
+ view.will_paginate WillPaginate::Collection.new(1, 1, 0), {}
+
+ WillPaginate::ViewHelpers.pagination_options.unstub(:merge)
+ end
- it "should use the :renderer supplied as an option if present." do
- expectation = { :renderer => "OptionRenderer" }
- WillPaginate::ViewHelpers.pagination_options.stubs(:merge).with(expectation).returns(expectation)
+ it "should use the :renderer supplied as an option if present." do
+ expectation = { :renderer => "OptionRenderer" }
+ WillPaginate::ViewHelpers.pagination_options.stubs(:merge).with(expectation).returns(expectation)
- view = ActionView::Base.new([], @assigns, @controller)
- view.will_paginate WillPaginate::Collection.new(1, 1, 0), expectation
+ view = ActionView::Base.new([], @assigns, @controller)
+ view.will_paginate WillPaginate::Collection.new(1, 1, 0), expectation
- WillPaginate::ViewHelpers.pagination_options.unstub(:merge)
+ WillPaginate::ViewHelpers.pagination_options.unstub(:merge)
+ end
end
## basic pagination ##
Please sign in to comment.
Something went wrong with that request. Please try again.