-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathworkflows_spec.rb
More file actions
64 lines (56 loc) · 1.63 KB
/
workflows_spec.rb
File metadata and controls
64 lines (56 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# frozen_string_literal: true
require_relative "../lib/embed_workflow"
require "net/http"
describe "workflows" do
before do
allow_any_instance_of(EmbedWorkflow::Client)
.to receive(:execute_request)
.with(instance_of(Net::HTTPRequest))
.and_return("response")
end
describe "#list" do
before do
allow_any_instance_of(EmbedWorkflow::Client)
.to receive(:get_request)
.with({ path: "/api/v1/workflows", params: {} })
.and_return("response")
end
it "sends the correct parameters to the workflows API" do
EmbedWorkflow::Workflows.list
end
context "with pagination parameters" do
before do
allow_any_instance_of(EmbedWorkflow::Client)
.to receive(:get_request)
.with({
path: "/api/v1/workflows",
params: {
starting_after: "550e8400-e29b-41d4-a716-446655440000",
limit: 10
}
})
.and_return("response")
end
it "sends the correct pagination parameters" do
EmbedWorkflow::Workflows.list(
starting_after: "550e8400-e29b-41d4-a716-446655440000",
limit: 10
)
end
end
context "with user_key parameter" do
before do
allow_any_instance_of(EmbedWorkflow::Client)
.to receive(:get_request)
.with({
path: "/api/v1/workflows",
params: { user_key: "api-user-1" }
})
.and_return("response")
end
it "sends the correct user_key parameter" do
EmbedWorkflow::Workflows.list(user_key: "api-user-1")
end
end
end
end