mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
36 lines
670 B
Text
36 lines
670 B
Text
|
describe "webmock tests" do
|
||
|
before(:each) do
|
||
|
WebMock.enable!
|
||
|
end
|
||
|
|
||
|
after(:each) do
|
||
|
WebMock.disable!
|
||
|
end
|
||
|
|
||
|
it "port" do
|
||
|
port = rand(1000...9999)
|
||
|
stub_request(:any, "localhost:#{port}")
|
||
|
|
||
|
query = Cutlass::FunctionQuery.new(
|
||
|
port: port
|
||
|
).call
|
||
|
|
||
|
expect(WebMock).to have_requested(:post, "localhost:#{port}").
|
||
|
with(body: "{}")
|
||
|
end
|
||
|
|
||
|
it "body" do
|
||
|
body = { lol: "hi" }
|
||
|
port = 8080
|
||
|
stub_request(:any, "localhost:#{port}")
|
||
|
|
||
|
query = Cutlass::FunctionQuery.new(
|
||
|
port: port
|
||
|
body: body
|
||
|
).call
|
||
|
|
||
|
expect(WebMock).to have_requested(:post, "localhost:#{port}").
|
||
|
with(body: body.to_json)
|
||
|
end
|
||
|
end
|