Skip to content

Commit cb37963

Browse files
author
Sam Phippen
committed
Fix up view example groups.
`controller.request.path_parameters` is no longer able to be directly assigned to, but should instead be mutated. Here, we take what we were doing before with the assignment and doing a reverse merge instead, which has the same affect.
1 parent 2bd4f18 commit cb37963

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/rspec/rails/example/view_example_group.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,14 @@ def _include_controller_helpers
159159
end
160160

161161
controller.controller_path = _controller_path
162-
controller.request.path_parameters[:controller] = _controller_path
163-
controller.request.path_parameters[:action] = _inferred_action unless _inferred_action =~ /^_/
162+
163+
path_params_to_merge = {}
164+
path_params_to_merge[:controller] = _controller_path
165+
path_params_to_merge[:action] = _inferred_action unless _inferred_action =~ /^_/
166+
167+
path_params = controller.request.path_parameters
168+
169+
controller.request.path_parameters = path_params.reverse_merge(path_params_to_merge)
164170
controller.request.path = ViewPathBuilder.new(::Rails.application.routes).path_for(controller.request.path_parameters)
165171
ViewSpecMethods.add_to(::ActionView::TestCase::TestController)
166172
end

0 commit comments

Comments
 (0)