|
32 | 32 | it "post success" do |
33 | 33 | stub_http("/my/test/url", [200, {}, '{"ok": true, "thing": "123"}']) |
34 | 34 |
|
35 | | - response = service_post("/my/test/url", { token: "1234" }.to_json, {}) do |inner_response| |
| 35 | + response = service_post("http://example.com/my/test/url", { token: "1234" }.to_json, {}) do |inner_response| |
36 | 36 | body = JSON.parse(inner_response.body) |
37 | 37 | { thing: body["thing"] } |
38 | 38 | end |
39 | 39 |
|
40 | 40 | expect(response[:ok]).to eq(true) |
41 | 41 | expect(response[:params]).to eq('{"token":"1234"}') |
42 | | - expect(response[:endpoint_url]).to eq("/my/test/url") |
| 42 | + expect(response[:endpoint_url]).to eq("http://example.com/my/test/url") |
43 | 43 | expect(response[:status]).to eq(200) |
44 | 44 | end |
45 | 45 |
|
46 | 46 | it "post redirect success" do |
47 | | - stub_http("/my/test/url", [307, { "Location" => "/my/redirect/url" }, '{"ok": false, "redirect": true}']) |
| 47 | + stub_http("/my/test/url", [307, { "Location" => "http://example.com/my/redirect/url" }, '{"ok": false, "redirect": true}']) |
48 | 48 | stub_http("/my/redirect/url", [200, {}, '{"ok": true, "thing": "123"}']) |
49 | 49 |
|
50 | | - response = service_post_with_redirects("/my/test/url", { token: "1234" }.to_json, {}) do |inner_response| |
| 50 | + response = service_post_with_redirects("http://example.com/my/test/url", { token: "1234" }.to_json, {}) do |inner_response| |
51 | 51 | body = JSON.parse(inner_response.body) |
52 | 52 | { thing: body["thing"] } |
53 | 53 | end |
54 | 54 |
|
55 | 55 | expect(response[:ok]).to eq(true) |
56 | 56 | expect(response[:params]).to eq('{"token":"1234"}') |
57 | | - expect(response[:endpoint_url]).to eq("/my/test/url") |
| 57 | + expect(response[:endpoint_url]).to eq("http://example.com/my/test/url") |
58 | 58 | expect(response[:status]).to eq(200) |
59 | 59 | end |
60 | 60 |
|
61 | 61 | it "post http failure" do |
62 | 62 | stub_http("/my/wrong/url", [404, {}, ""]) |
63 | 63 |
|
64 | | - expect { service_post("/my/wrong/url", { token: "1234" }.to_json, {}) }.to raise_error(CC::Service::HTTPError) |
| 64 | + expect { service_post("http://example.com/my/wrong/url", { token: "1234" }.to_json, {}) }.to raise_error(CC::Service::HTTPError) |
65 | 65 | end |
66 | 66 |
|
67 | 67 | it "post some other failure" do |
68 | 68 | stub_http("/my/wrong/url") { raise ArgumentError, "lol" } |
69 | 69 |
|
70 | | - expect { service_post("/my/wrong/url", { token: "1234" }.to_json, {}) }.to raise_error(ArgumentError) |
| 70 | + expect { service_post("http://example.com/my/wrong/url", { token: "1234" }.to_json, {}) }.to raise_error(ArgumentError) |
71 | 71 | end |
72 | 72 |
|
73 | 73 | it "services" do |
|
0 commit comments