summaryrefslogtreecommitdiff
path: root/spec/syntax_suggest/fixtures/webmock.rb.txt
diff options
context:
space:
mode:
Diffstat (limited to 'spec/syntax_suggest/fixtures/webmock.rb.txt')
-rw-r--r--spec/syntax_suggest/fixtures/webmock.rb.txt35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/syntax_suggest/fixtures/webmock.rb.txt b/spec/syntax_suggest/fixtures/webmock.rb.txt
new file mode 100644
index 0000000000..16da0d2ac0
--- /dev/null
+++ b/spec/syntax_suggest/fixtures/webmock.rb.txt
@@ -0,0 +1,35 @@
+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