File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed
spec/rspec/rails/matchers Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 1
1
version_file = File.expand_path("../.rails-version", __FILE__)
2
2
case version = ENV['RAILS_VERSION'] || (File.exist?(version_file) && File.read(version_file).chomp)
3
3
when /master/
4
- gem "rails", :git => "git://github.com/rails /rails.git "
4
+ gem "rails", :path => "/Users/sam/dev /rails"
5
5
gem "arel", :git => "git://github.com/rails/arel.git"
6
6
gem "journey", :git => "git://github.com/rails/journey.git"
7
7
gem "activerecord-deprecated_finders", :git => "git://github.com/rails/activerecord-deprecated_finders.git"
8
8
gem "rails-observers", :git => "git://github.com/rails/rails-observers"
9
- gem "web-console", :git => "git://github.com/rails/web-console"
9
+ gem "web-console", :git => "git://github.com/rails/web-console", :group => :development
10
10
gem 'sass-rails', :git => "git://github.com/rails/sass-rails.git"
11
11
gem 'coffee-rails', :git => "git://github.com/rails/coffee-rails.git"
12
12
gem 'rack', :git => 'git://github.com/rack/rack.git'
Original file line number Diff line number Diff line change @@ -157,8 +157,14 @@ def _include_controller_helpers
157
157
end
158
158
159
159
controller . controller_path = _controller_path
160
- controller . request . path_parameters [ :controller ] = _controller_path
161
- controller . request . path_parameters [ :action ] = _inferred_action unless _inferred_action =~ /^_/
160
+
161
+ path_params_to_merge = { }
162
+ path_params_to_merge [ :controller ] = _controller_path
163
+ path_params_to_merge [ :action ] = _inferred_action unless _inferred_action =~ /^_/
164
+
165
+ path_params = controller . request . path_parameters
166
+
167
+ controller . request . path_parameters = path_params . reverse_merge ( path_params_to_merge )
162
168
end
163
169
164
170
let ( :_default_file_to_render ) do |example |
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ def as_test_response(obj)
46
46
resp . headers . clear
47
47
resp . headers . merge! ( obj . response_headers )
48
48
resp . body = obj . body
49
+ resp . request = ActionDispatch ::Request . new ( { } )
49
50
end
50
51
::ActionDispatch ::TestResponse . from_response ( obj )
51
52
else
Original file line number Diff line number Diff line change 4
4
include RSpec ::Rails ::Matchers
5
5
6
6
def create_response ( opts = { } )
7
- ActionDispatch ::TestResponse . new ( opts . fetch ( :status ) )
7
+ ActionDispatch ::TestResponse . new ( opts . fetch ( :status ) ) . tap { |x |
8
+ x . request = ActionDispatch ::Request . new ( { } )
9
+ }
8
10
end
9
11
10
12
shared_examples_for "supports different response instances" do
11
13
context "given an ActionDispatch::Response" do
12
14
it "returns true for a response with the same code" do
13
- response = ::ActionDispatch ::Response . new ( code )
15
+ response = ::ActionDispatch ::Response . new ( code ) . tap { |x |
16
+ x . request = ActionDispatch ::Request . new ( { } )
17
+ }
14
18
15
19
expect ( matcher . matches? ( response ) ) . to be ( true )
16
20
end
17
21
end
18
22
19
23
context "given an ActionDispatch::TestResponse" do
20
24
it "returns true for a response with the same code" do
21
- response = ::ActionDispatch ::TestResponse . new ( code )
25
+ response = ::ActionDispatch ::TestResponse . new ( code ) . tap { |x |
26
+ x . request = ActionDispatch ::Request . new ( { } )
27
+ }
22
28
23
29
expect ( matcher . matches? ( response ) ) . to be ( true )
24
30
end
@@ -430,5 +436,4 @@ def create_response(opts = {})
430
436
expect { have_http_status ( nil ) } . to raise_error ArgumentError
431
437
end
432
438
end
433
-
434
439
end
You can’t perform that action at this time.
0 commit comments