Skip to content
This repository
Browse code

Merge pull request #463 from ndbroadbent/fix_path_parameters

Change request.path_parameters keys to symbols to match real Rails environment
  • Loading branch information...
commit 2987f7f228a146fa16b5410d181b1386938e0765 2 parents e1fd5b6 + bc98726
David Chelimsky authored April 22, 2012
14  features/view_specs/view_spec.feature
@@ -158,3 +158,17 @@ Feature: view spec
158 158
       """
159 159
     When I run `rspec spec/views/secrets`
160 160
     Then the examples should all pass
  161
+
  162
+  Scenario: request.path_parameters should match Rails by using symbols for keys
  163
+    Given a file named "spec/views/widgets/index.html.erb_spec.rb" with:
  164
+      """
  165
+      require "spec_helper"
  166
+
  167
+      describe "controller.request.path_parameters" do
  168
+        it "matches the Rails environment by using symbols for keys" do
  169
+          [:controller, :action].each { |k| controller.request.path_parameters.keys.should include(k) }
  170
+        end
  171
+      end
  172
+      """
  173
+    When I run `rspec spec/views`
  174
+    Then the examples should all pass
4  lib/rspec/rails/example/view_example_group.rb
@@ -133,8 +133,8 @@ def _include_controller_helpers
133 133
           # rails 3.0
134 134
           controller.controller_path = _controller_path
135 135
         end
136  
-        controller.request.path_parameters["controller"] = _controller_path
137  
-        controller.request.path_parameters["action"]     = _inferred_action unless _inferred_action =~ /^_/
  136
+        controller.request.path_parameters[:controller] = _controller_path
  137
+        controller.request.path_parameters[:action]     = _inferred_action unless _inferred_action =~ /^_/
138 138
       end
139 139
     end
140 140
   end

0 notes on commit 2987f7f

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