Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rails 3.0.1 and up uses view_assigns instead of _assigns. This commit

supports both.
  • Loading branch information...
commit 7de6d053c2ad442517ad9906cd64ec04a752675e 1 parent f5ba00e
@dchelimsky dchelimsky authored
View
2  lib/rspec/rails/example/helper_example_group.rb
@@ -49,7 +49,7 @@ module InstanceMethods
# Returns an instance of ActionView::Base with the helper being specified
# mixed in, along with any of the built-in rails helpers.
def helper
- _view.tap {|v| v.assign(_assigns)}
+ _view.tap {|v| v.assign(view_assigns)}
end
private
View
10 lib/rspec/rails/view_assigns.rb
@@ -15,13 +15,19 @@ def assign(key, value)
private
- def _encapsulated_assigns
- @_encapsulated_assigns ||= {}
+ # === Rails-3.0.1 and up calls down to this
+ def view_assigns
+ super.merge(_encapsulated_assigns)
end
+ # === Rails-3.0.0 calls down to this
def _assigns
super.merge(_encapsulated_assigns)
end
+
+ def _encapsulated_assigns
+ @_encapsulated_assigns ||= {}
+ end
end
end
end

2 comments on commit 7de6d05

@solnic

Are you saying they've changed the public API in a minor version upgrade?

@dchelimsky
Owner

3.0.1 will support both with a deprecation warning on _assigns.

Please sign in to comment.
Something went wrong with that request. Please try again.