File tree Expand file tree Collapse file tree 4 files changed +7
-6
lines changed
spec/rspec/rails/matchers Expand file tree Collapse file tree 4 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,12 @@ def as_test_response(obj)
41
41
# Acts As Capybara Session
42
42
# Hack to support `Capybara::Session` without having to load
43
43
# Capybara or catch `NameError`s for the undefined constants
44
- :: ActionDispatch ::TestResponse . new . tap do |resp |
44
+ obj = ActionDispatch ::Response . new . tap do |resp |
45
45
resp . status = obj . status_code
46
46
resp . headers = obj . response_headers
47
47
resp . body = obj . body
48
48
end
49
+ ::ActionDispatch ::TestResponse . from_response ( obj )
49
50
else
50
51
raise TypeError , "Invalid response type: #{ obj } "
51
52
end
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
- ActionController ::TestResponse . new ( opts . fetch ( :status ) )
7
+ ActionDispatch ::TestResponse . new ( opts . fetch ( :status ) )
8
8
end
9
9
10
10
shared_examples_for "supports different response instances" do
Original file line number Diff line number Diff line change 3
3
%w[ have_rendered render_template ] . each do |template_expectation |
4
4
describe template_expectation do
5
5
include RSpec ::Rails ::Matchers ::RenderTemplate
6
- let ( :response ) { ActionController ::TestResponse . new }
6
+ let ( :response ) { ActionDispatch ::TestResponse . new }
7
7
8
8
context "given a hash" do
9
9
it "delegates to assert_template" do
@@ -90,7 +90,7 @@ def assert_template(*); raise "oops"; end
90
90
end
91
91
92
92
context "when fails with a redirect" do
93
- let ( :response ) { ActionController ::TestResponse . new ( 302 ) }
93
+ let ( :response ) { ActionDispatch ::TestResponse . new ( 303 ) }
94
94
95
95
def assert_template ( *)
96
96
message = "expecting <'template_name'> but rendering with <[]>"
@@ -102,7 +102,7 @@ def normalize_argument_to_redirection(response_redirect_location)
102
102
end
103
103
104
104
it "gives informative error message" do
105
- response = ActionController ::TestResponse . new ( 302 )
105
+ response = ActionDispatch ::TestResponse . new ( 302 )
106
106
response . location = "http://test.host/widgets/1"
107
107
expect do
108
108
expect ( response ) . to send ( template_expectation , "template_name" )
Original file line number Diff line number Diff line change 5
5
describe "redirect_to" do
6
6
include RSpec ::Rails ::Matchers ::RedirectTo
7
7
8
- let ( :response ) { ActionController ::TestResponse . new }
8
+ let ( :response ) { ActionDispatch ::TestResponse . new }
9
9
10
10
context "with should" do
11
11
context "when assert_redirected_to passes" do
You can’t perform that action at this time.
0 commit comments