http_stub 0.28.0 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36a7a947b8f803c0ec1851b4e646d6c579bed2765195b7277a809b6a7500c895
4
- data.tar.gz: 55e0b0a5ae19f81277e5c0c8fac67d58c0f2936b1a6240e03537f0090036fad1
3
+ metadata.gz: ab001052c9da654ca147cea62f81abed886e43edeef83a22acd40963d58bc2db
4
+ data.tar.gz: 46a948bda0855ee0ec2ba377a5f119e964360dd2983e96d69ac652755fd45881
5
5
  SHA512:
6
- metadata.gz: 0202cba44793df890e435672550795d988f13614471e9220eb1796965237e080ffeccd6cb54e62a8cc1ffe75684711b9ce80abeb662503c42130f9292d1624eb
7
- data.tar.gz: ca13e5950fa73d3a5ff6dce748b37a4ef93f071dec782f46cea0ba71a00fb7fc3d08aa8ef47c3926df84a94f22d59c9839d0594704f3d5c23cea8a5b5f635137
6
+ metadata.gz: 7c08e5cafbea2f544c1808a80639684f4534bb88a185fe54082ddc2e444cba1da758aa39d85d7adb7ed53ae06ce8e1a316f39aca696beebf38762fcf9b7de0fa
7
+ data.tar.gz: 275cadedb2123fcd4d5928a35266e6139d361776a3f040ff6b34263d43d107d21c24be1c4bd82eeb5e8b2c7cf92e9cc99f9c0e2ef86ad4adb11a8e53d07e86c6
@@ -30,6 +30,7 @@ module HttpStub
30
30
  scenario = HttpStub::Configurator::Scenario.new(name, @server_stub_template)
31
31
  yield scenario
32
32
  @state.add_scenario(scenario)
33
+ scenario
33
34
  end
34
35
 
35
36
  def add_scenario_with_one_stub!(name, stub=nil, &block)
@@ -1,3 +1,3 @@
1
1
  module HttpStub
2
- VERSION = "0.28.0".freeze
2
+ VERSION = "0.28.1".freeze
3
3
  end
@@ -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("scenario_initially_activated")
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.code).to eql(202)
25
- expect(response.body).to eql("scenario initially activated body")
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(:built_stub) { instance_double(HttpStub::Configurator::Stub::Stub) }
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) { "some/scenario/name" }
145
- let(:block) { lambda { |_scenario| "some 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.0
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-06-27 00:00:00.000000000 Z
15
+ date: 2019-07-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake