Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Apr 22, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions features/view_specs/view_spec.feature
Expand Up @@ -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 changes: 2 additions & 2 deletions lib/rspec/rails/example/view_example_group.rb
Expand Up @@ -133,8 +133,8 @@ def _include_controller_helpers
# rails 3.0
controller.controller_path = _controller_path
end
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 =~ /^_/
end
end
end
Expand Down