Permalink
Browse files

Sets `#controller_path` in all versions of Rails

* Fixes #316
  • Loading branch information...
alindeman committed Oct 7, 2012
1 parent a77de85 commit 724578d02e3e48606586ee12c017f5bf03cd2691
View
@@ -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)
@@ -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
"""
@@ -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 724578d

Please sign in to comment.