optimus_prime 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/optimus_prime/server.rb +5 -3
- data/lib/optimus_prime/version.rb +1 -1
- data/optimus_prime.log +1104 -0
- data/spec/lib/optimus_prime_spec.rb +5 -7
- metadata +1 -1
@@ -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(
|
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(
|
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([{
|
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([{
|
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
|
|