http_stub 0.28.0 → 0.28.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/http_stub/configurator/server.rb +1 -0
- data/lib/http_stub/version.rb +1 -1
- data/spec/acceptance/endpoint_template_spec.rb +9 -4
- data/spec/lib/http_stub/configurator/endpoint_template_spec.rb +7 -2
- data/spec/lib/http_stub/configurator/server_spec.rb +11 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab001052c9da654ca147cea62f81abed886e43edeef83a22acd40963d58bc2db
|
4
|
+
data.tar.gz: 46a948bda0855ee0ec2ba377a5f119e964360dd2983e96d69ac652755fd45881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c08e5cafbea2f544c1808a80639684f4534bb88a185fe54082ddc2e444cba1da758aa39d85d7adb7ed53ae06ce8e1a316f39aca696beebf38762fcf9b7de0fa
|
7
|
+
data.tar.gz: 275cadedb2123fcd4d5928a35266e6139d361776a3f040ff6b34263d43d107d21c24be1c4bd82eeb5e8b2c7cf92e9cc99f9c0e2ef86ad4adb11a8e53d07e86c6
|
data/lib/http_stub/version.rb
CHANGED
@@ -18,11 +18,16 @@ describe "Endpoint template acceptance" do
|
|
18
18
|
expect(response.body).to eql("custom stub body")
|
19
19
|
end
|
20
20
|
|
21
|
-
it "registers any stubs for templated scenarios initially activated" do
|
22
|
-
response = issue_request("
|
21
|
+
it "registers any stubs for templated scenarios initially activated via method chaining" do
|
22
|
+
response = issue_request("scenario_activated_via_chaining")
|
23
23
|
|
24
|
-
expect(response.
|
25
|
-
|
24
|
+
expect(response.body).to eql("scenario activated via chaining")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "registers any stubs for templated scenarios initially activated via a blocks" do
|
28
|
+
response = issue_request("scenario_activated_via_a_block")
|
29
|
+
|
30
|
+
expect(response.body).to eql("scenario activated via a block")
|
26
31
|
end
|
27
32
|
|
28
33
|
context "and a templated scenario is activated" do
|
@@ -121,13 +121,14 @@ describe HttpStub::Configurator::EndpointTemplate do
|
|
121
121
|
let(:block_verifier) { double("BlockVerifier") }
|
122
122
|
let(:block) { lambda { block_verifier.verify } }
|
123
123
|
|
124
|
-
let(:
|
124
|
+
let(:built_scenario) { instance_double(HttpStub::Configurator::Scenario) }
|
125
|
+
let(:built_stub) { instance_double(HttpStub::Configurator::Stub::Stub) }
|
125
126
|
|
126
127
|
subject { server_endpoint_template.add_scenario!(name, response_overrides, &block) }
|
127
128
|
|
128
129
|
before(:example) do
|
129
130
|
allow(endpoint_stub_template).to receive(:build_stub).and_return(built_stub)
|
130
|
-
allow(server).to receive(:add_scenario_with_one_stub!)
|
131
|
+
allow(server).to receive(:add_scenario_with_one_stub!).and_return(built_scenario)
|
131
132
|
end
|
132
133
|
|
133
134
|
it "builds a stub using any provided response overrides" do
|
@@ -143,6 +144,10 @@ describe HttpStub::Configurator::EndpointTemplate do
|
|
143
144
|
subject
|
144
145
|
end
|
145
146
|
|
147
|
+
it "returns the stub added to the server" do
|
148
|
+
expect(subject).to eql(built_scenario)
|
149
|
+
end
|
150
|
+
|
146
151
|
end
|
147
152
|
|
148
153
|
describe "#add_stub!" do
|
@@ -141,8 +141,8 @@ describe HttpStub::Configurator::Server do
|
|
141
141
|
|
142
142
|
describe "#add_scenario!" do
|
143
143
|
|
144
|
-
let(:scenario_name)
|
145
|
-
let(:block)
|
144
|
+
let(:scenario_name) { "some/scenario/name" }
|
145
|
+
let(:block) { lambda { |_scenario| "some block" } }
|
146
146
|
|
147
147
|
let(:scenario) { instance_double(HttpStub::Configurator::Scenario) }
|
148
148
|
|
@@ -175,6 +175,10 @@ describe HttpStub::Configurator::Server do
|
|
175
175
|
subject
|
176
176
|
end
|
177
177
|
|
178
|
+
it "returns the created scenario to support method chaining" do
|
179
|
+
expect(subject).to eql(scenario)
|
180
|
+
end
|
181
|
+
|
178
182
|
end
|
179
183
|
|
180
184
|
describe "#add_scenario_with_one_stub!" do
|
@@ -187,7 +191,7 @@ describe HttpStub::Configurator::Server do
|
|
187
191
|
|
188
192
|
subject { server.add_scenario_with_one_stub!(scenario_name, the_stub) }
|
189
193
|
|
190
|
-
before(:each) { allow(server).to receive(:add_scenario!).and_yield(scenario) }
|
194
|
+
before(:each) { allow(server).to receive(:add_scenario!).and_yield(scenario).and_return(scenario) }
|
191
195
|
|
192
196
|
it "adds a scenario with the provided name" do
|
193
197
|
expect(server).to receive(:add_scenario!).with(scenario_name)
|
@@ -195,6 +199,10 @@ describe HttpStub::Configurator::Server do
|
|
195
199
|
subject
|
196
200
|
end
|
197
201
|
|
202
|
+
it "returns the added scenario to support method chaining" do
|
203
|
+
expect(subject).to eql(scenario)
|
204
|
+
end
|
205
|
+
|
198
206
|
context "when a stub is provided" do
|
199
207
|
|
200
208
|
subject { server.add_scenario_with_one_stub!(scenario_name, the_stub) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_stub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.28.
|
4
|
+
version: 0.28.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dueckes
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2019-
|
15
|
+
date: 2019-07-10 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rake
|