File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
spec/lib/vcr/library_hooks Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ gem "rspec", "~> 3.0"
27
27
gem "sinatra"
28
28
gem "test-unit" , "~> 3.4.4"
29
29
gem "timecop"
30
- gem "typhoeus" , "~> 1.1.0"
30
+ gem "typhoeus" , ">= 1.1.0"
31
31
gem "webmock"
32
32
gem "webrick"
33
33
gem "yard"
Original file line number Diff line number Diff line change @@ -92,11 +92,14 @@ def get_response
92
92
end
93
93
94
94
context 'when a request is made with a hash for the POST body' do
95
+ let ( :body ) { { foo : "17" } . to_json }
96
+
95
97
def make_request
96
98
VCR . use_cassette ( "hash_body" ) do
97
99
Typhoeus ::Request . post (
98
100
"http://localhost:#{ VCR ::SinatraApp . port } /return-request-body" ,
99
- :body => { :foo => "17" }
101
+ headers : { 'Content-Type' => "application/json" } ,
102
+ body : body
100
103
)
101
104
end
102
105
end
@@ -105,7 +108,7 @@ def make_request
105
108
recorded = make_request
106
109
played_back = make_request
107
110
108
- expect ( recorded . body ) . to eq ( "foo=17" )
111
+ expect ( recorded . body ) . to eq ( body )
109
112
expect ( played_back . body ) . to eq ( recorded . body )
110
113
end
111
114
end
@@ -121,10 +124,10 @@ def on_headers(&callback)
121
124
122
125
it { expect ( request . tap { |r | r . on_headers { } } ) . not_to be_streaming }
123
126
124
- it { expect { |b | on_headers ( &b ) } . to yield_with_args ( have_attributes ( headers : include ( 'Content-Length' => '18' ) ) ) }
127
+ it { expect { |b | on_headers ( &b ) } . to yield_with_args ( have_attributes ( headers : hash_including ( 'Content-Length' => '18' ) ) ) }
125
128
it { expect { |b | on_headers ( &b ) } . to yield_with_args ( have_attributes ( headers : match_array ( on_headers . headers ) ) ) }
126
129
127
- it { expect ( on_headers ) . to have_attributes ( headers : include ( "Content-Length" => "18" ) ) }
130
+ it { expect ( on_headers ) . to have_attributes ( headers : hash_including ( "Content-Length" => "18" ) ) }
128
131
it { expect ( on_headers ) . to have_attributes ( headers : match_array ( on_headers . headers ) ) }
129
132
end
130
133
You can’t perform that action at this time.
0 commit comments