Skip to content
Browse files

Merge branch 'issue_316'

  • Loading branch information...
2 parents a77de85 + 724578d commit 3214564f9495e20271ffa947a0a20eb8f6fa40a7 @alindeman alindeman committed Oct 7, 2012
View
2 Changelog.md
@@ -11,6 +11,8 @@ Bug fixes
* Add `should` and `should_not` to `CollectionProxy` (Rails 3.1+) and
`AssociationProxy` (Rails 3.0). (Myron Marston)
+* `controller.controller_path` is set correctly for view specs in Rails 3.1+.
+ (Andy Lindeman)
### 2.11.0 / 2012-07-07
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.10.1...v2.11.0)
View
1 features/view_specs/inferred_controller_path.feature
@@ -8,6 +8,7 @@ Feature: view spec infers controller path and action
describe "widgets/new" do
it "infers the controller path" do
expect(controller.request.path_parameters[:controller]).to eq("widgets")
+ expect(controller.controller_path).to eq("widgets")
end
end
"""
View
5 lib/rspec/rails/example/view_example_group.rb
@@ -142,10 +142,9 @@ def _include_controller_helpers
if view.lookup_context.respond_to?(:prefixes)
# rails 3.1
view.lookup_context.prefixes << _controller_path
- else
- # rails 3.0
- controller.controller_path = _controller_path
end
+
+ controller.controller_path = _controller_path
controller.request.path_parameters[:controller] = _controller_path
controller.request.path_parameters[:action] = _inferred_action unless _inferred_action =~ /^_/
end

0 comments on commit 3214564

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