File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,17 @@ def dummy_app
11
11
lambda { |env | [ 200 , { } , [ 'Dummy App' ] ] }
12
12
end
13
13
14
+ let ( :http_streaming_response ) {
15
+ double (
16
+ "Rack::HttpStreamingResponse" ,
17
+ :use_ssl= => nil ,
18
+ :verify_mode= => nil ,
19
+ :headers => { } ,
20
+ :status => 200 ,
21
+ :body => "OK"
22
+ )
23
+ }
24
+
14
25
describe "as middleware" do
15
26
def app
16
27
Rack ::ReverseProxy . new ( dummy_app ) do
@@ -145,7 +156,8 @@ def app
145
156
146
157
it "should make request with basic auth" do
147
158
stub_request ( :get , "http://example.com/test/slow" )
148
- Rack ::HttpStreamingResponse . any_instance . should_receive ( :read_timeout= ) . with ( 99 )
159
+ allow ( Rack ::HttpStreamingResponse ) . to receive ( :new ) . and_return ( http_streaming_response )
160
+ expect ( http_streaming_response ) . to receive ( :read_timeout= ) . with ( 99 )
149
161
get '/test/slow'
150
162
end
151
163
end
@@ -159,7 +171,8 @@ def app
159
171
160
172
it "should make request with basic auth" do
161
173
stub_request ( :get , "http://example.com/test/slow" )
162
- Rack ::HttpStreamingResponse . any_instance . should_not_receive ( :read_timeout= )
174
+ allow ( Rack ::HttpStreamingResponse ) . to receive ( :new ) . and_return ( http_streaming_response )
175
+ expect ( http_streaming_response ) . not_to receive ( :read_timeout= )
163
176
get '/test/slow'
164
177
end
165
178
end
Original file line number Diff line number Diff line change 13
13
config . expect_with :rspec do |expectations |
14
14
# This option will default to `true` in RSpec 4.
15
15
expectations . include_chain_clauses_in_custom_matcher_descriptions = true
16
- expectations . syntax = [ :should ]
16
+ expectations . syntax = [ :should , :expect ]
17
17
end
18
18
config . mock_with :rspec do |mocks |
19
19
mocks . verify_doubled_constant_names = true
20
20
mocks . verify_partial_doubles = true
21
- mocks . syntax = [ :should ]
21
+ mocks . syntax = [ :should , :expect ]
22
22
# Prevents you from mocking or stubbing a method that does not exist on
23
23
# a real object. This is generally recommended, and will default to
24
24
# `true` in RSpec 4.
You can’t perform that action at this time.
0 commit comments