Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Need to support view_assigns in either case.

  • Loading branch information...
commit 5a357188d75b1f8836a7dad8ec340eff1cb5756f 1 parent 7de6d05
David Chelimsky dchelimsky authored
21 lib/rspec/rails/view_assigns.rb
View
@@ -13,17 +13,20 @@ def assign(key, value)
_encapsulated_assigns[key] = value
end
- private
-
- # === Rails-3.0.1 and up calls down to this
- def view_assigns
- super.merge(_encapsulated_assigns)
+ if ::Rails::VERSION::STRING == "3.0.0"
+ def _assigns
+ super.merge(_encapsulated_assigns)
+ end
+ def view_assigns
+ _assigns
+ end
+ else # >= 3.0.1
+ def view_assigns
+ super.merge(_encapsulated_assigns)
+ end
end
- # === Rails-3.0.0 calls down to this
- def _assigns
- super.merge(_encapsulated_assigns)
- end
+ private
def _encapsulated_assigns
@_encapsulated_assigns ||= {}
2  spec/rspec/rails/example/helper_example_group_spec.rb
View
@@ -24,7 +24,7 @@ module ::FoosHelper; end
describe "#helper" do
it "returns the instance of AV::Base provided by AV::TC::Behavior" do
helper_spec = Object.new.extend HelperExampleGroup::InstanceMethods
- helper_spec.should_receive(:_assigns)
+ helper_spec.should_receive(:view_assigns)
av_tc_b_view = double('_view')
av_tc_b_view.should_receive(:assign)
helper_spec.stub(:_view) { av_tc_b_view }
Please sign in to comment.
Something went wrong with that request. Please try again.