optimus_prime 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -163,28 +163,26 @@ describe OptimusPrime do
163
163
 
164
164
  it "GET" do
165
165
  op.prime("continue", { username: "Test" }.to_json, content_type: :json)
166
- ::Faraday.get("http://localhost:7003/get/continue")
167
- expect( ::Faraday.get("http://localhost:7003/requests/continue").body ).to include("\"requests\":[{\"method\":\"GET\",\"body\":{}}]")
168
- expect( op.requests("continue") ).to eq([{ "method" => "GET", "body" => {} }])
166
+ ::Faraday.get("http://localhost:7003/get/continue", nil, { "Content-Type" => "application/json", "Accept" => "application/json" })
167
+ expect( op.requests("continue") ).to eq([{ "method" => "GET", "body" => {}, "headers" => { "content_type" => "application/json", "accept" => ["application/json"] } }])
169
168
  end
170
169
 
171
170
  it "POST" do
172
171
  op.prime("kermit", { username: "Test" }.to_json, content_type: :json)
173
172
  ::Faraday.post("http://localhost:7003/get/kermit", { username: "Test" })
174
- expect( ::Faraday.get("http://localhost:7003/requests/kermit").body ).to include("\"requests\":[{\"method\":\"POST\",\"body\":{\"username\":\"Test\"}}]")
175
- expect( op.requests("kermit") ).to eq([{ "method" => "POST", "body" => { "username" => "Test" } }])
173
+ expect( op.requests("kermit") ).to eq([{ "method" => "POST", "body" => { "username" => "Test" }, "headers"=>{ "content_type"=>"application/x-www-form-urlencoded", "accept"=>["*/*"]} }])
176
174
  end
177
175
 
178
176
  it "PUT" do
179
177
  op.prime("put/kermit", { username: "Test" }.to_json, content_type: :json)
180
178
  ::Faraday.put("http://localhost:7003/get/put/kermit", { username: "Test" })
181
- expect( op.requests("put/kermit") ).to eq([{ "method" => "PUT", "body" => { "username" => "Test" } }])
179
+ expect( op.requests("put/kermit") ).to eq([{"method"=>"PUT", "body"=>{"username"=>"Test"}, "headers"=>{"content_type"=>"application/x-www-form-urlencoded", "accept"=>["*/*"]}}])
182
180
  end
183
181
 
184
182
  it "returns a decoded body" do
185
183
  op.prime("kermit", { username: "Test" }.to_json, content_type: :json)
186
184
  ::Faraday.post("http://localhost:7003/get/kermit", { word: "with spaces and other shit" })
187
- expect( op.requests("kermit") ).to eq([{ "method" => "POST", "body" => {"word" => "with spaces and other shit"} }])
185
+ expect( op.requests("kermit") ).to eq([{"method"=>"POST", "body"=>{"word"=>"with spaces and other shit"}, "headers"=>{"content_type"=>"application/x-www-form-urlencoded", "accept"=>["*/*"]}}])
188
186
  end
189
187
 
190
188
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimus_prime
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Nalesso