Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Change request.path_parameters keys to symbols to match real Rails environment #463

merged 2 commits into from

2 participants


Can you add specs for this?

@ndbroadbent ndbroadbent request.path_parameters 'controller' and 'action' keys should be symb…
…ols, since they are symbols in the real Rails environment.

I wasn't sure how to add specs for this, since it's the included -> before block, so I've written a cucumber scenario for it at the bottom of view_specs/view_spec.feature.

Not sure if I've done this right, so please let me know if it needs to be moved / rewritten in a different way.

@dchelimsky dchelimsky merged commit 2987f7f into from
@dchelimsky dchelimsky referenced this pull request from a commit
@dchelimsky dchelimsky Changelog for #463 [ci skip] 89da19c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 21, 2011
  1. @ndbroadbent

    request.path_parameters 'controller' and 'action' keys should be symb…

    ndbroadbent authored
    …ols, since they are symbols in the real Rails environment.
Commits on Jan 11, 2012
  1. @ndbroadbent
This page is out of date. Refresh to see the latest.
14 features/view_specs/view_spec.feature
@@ -158,3 +158,17 @@ Feature: view spec
When I run `rspec spec/views/secrets`
Then the examples should all pass
+ Scenario: request.path_parameters should match Rails by using symbols for keys
+ Given a file named "spec/views/widgets/index.html.erb_spec.rb" with:
+ """
+ require "spec_helper"
+ describe "controller.request.path_parameters" do
+ it "matches the Rails environment by using symbols for keys" do
+ [:controller, :action].each { |k| controller.request.path_parameters.keys.should include(k) }
+ end
+ end
+ """
+ When I run `rspec spec/views`
+ Then the examples should all pass
4 lib/rspec/rails/example/view_example_group.rb
@@ -133,8 +133,8 @@ def _include_controller_helpers
# rails 3.0
controller.controller_path = _controller_path
- controller.request.path_parameters["controller"] = _controller_path
- controller.request.path_parameters["action"] = _inferred_action unless _inferred_action =~ /^_/
+ controller.request.path_parameters[:controller] = _controller_path
+ controller.request.path_parameters[:action] = _inferred_action unless _inferred_action =~ /^_/
Something went wrong with that request. Please try again.