http_stub 0.19.0 → 0.19.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd84700c863cf0c87b4be11b874723b35475c6fb
4
- data.tar.gz: 2857f2d1bd0c3ab6b1bf4ca0a01753bf69b20234
3
+ metadata.gz: db776c7504fe1de45fec47a235aabd80355a1f10
4
+ data.tar.gz: 9900db1809f2a8404f17bd8c53b1d161d87c00ff
5
5
  SHA512:
6
- metadata.gz: f37b401cd641a3b8874f8cd40a4074f2db3ce886d8bedba62b533a7ef2e7dbc999a796cf3e9c86bdcf9f857cbd169276a0464ee40205984db01405aca531e499
7
- data.tar.gz: 792b251f35f1fe21026106d931ee053162840b569aa7ffc3fa3c52a89921c9fc3c7dab7e01cf30563fbac3e8baa670833dcf4638b1aeef3d0e27e0625b55654b
6
+ metadata.gz: b7e98fe17e5a5af10bf737bc77d6766f53f4c3557a8a3130cf851fffe63089632433844a24471ec4c3e60b2976faa03fe963982a6cb5e6f5f623d047b6cf4087
7
+ data.tar.gz: f0a8e46fa7721be673816eb64e8311b92c1a6b02dd67455769cf2e676d02b7b8c38b94ff7476a4034658777942d8987b26eb91d5ff0a96692366a4e4164dc470
@@ -40,9 +40,9 @@ module HttpStub
40
40
  @server_facade.define_scenario(builder.build)
41
41
  end
42
42
 
43
- def add_scenario_with_one_stub!(name, &block)
43
+ def add_scenario_with_one_stub!(name, builder=nil, &block)
44
44
  add_scenario!(name) do |scenario|
45
- scenario.add_stub! { |stub| stub.invoke(&block) }
45
+ scenario.add_stub!(builder) { |stub| stub.invoke(&block) }
46
46
  end
47
47
  end
48
48
 
@@ -1,3 +1,3 @@
1
1
  module HttpStub
2
- VERSION = "0.19.0".freeze
2
+ VERSION = "0.19.1".freeze
3
3
  end
@@ -186,15 +186,12 @@ describe HttpStub::Configurer::DSL::Server do
186
186
  let(:block_verifier) { double("BlockVerifier") }
187
187
  let(:block) { lambda { block_verifier.verify } }
188
188
 
189
- let(:scenario_builder) { instance_double(HttpStub::Configurer::DSL::ScenarioBuilder) }
189
+ let(:scenario_builder) { instance_double(HttpStub::Configurer::DSL::ScenarioBuilder, add_stub!: nil) }
190
190
  let(:stub_builder) { instance_double(HttpStub::Configurer::DSL::StubBuilder, invoke: nil) }
191
191
 
192
- subject { server.add_scenario_with_one_stub!(scenario_name, &block) }
192
+ subject { server.add_scenario_with_one_stub!(scenario_name, stub_builder) }
193
193
 
194
- before(:each) do
195
- allow(server).to receive(:add_scenario!).and_yield(scenario_builder)
196
- allow(scenario_builder).to receive(:add_stub!).and_yield(stub_builder)
197
- end
194
+ before(:each) { allow(server).to receive(:add_scenario!).and_yield(scenario_builder) }
198
195
 
199
196
  it "adds a scenario with the provided name" do
200
197
  expect(server).to receive(:add_scenario!).with(scenario_name)
@@ -208,11 +205,34 @@ describe HttpStub::Configurer::DSL::Server do
208
205
  subject
209
206
  end
210
207
 
211
- it "requests the stub builder invoke the provided block" do
212
- expect(stub_builder).to receive(:invoke).and_yield
213
- expect(block_verifier).to receive(:verify)
208
+ context "when a builder is provided" do
209
+
210
+ subject { server.add_scenario_with_one_stub!(scenario_name, stub_builder) }
211
+
212
+ it "adds a stub to the scenario with the provided builder" do
213
+ expect(scenario_builder).to receive(:add_stub!).with(stub_builder)
214
+
215
+ subject
216
+ end
217
+
218
+ end
219
+
220
+ context "when a block is provided" do
221
+
222
+ let(:block_verifier) { double("BlockVerifier") }
223
+ let(:block) { lambda { block_verifier.verify } }
224
+
225
+ subject { server.add_scenario_with_one_stub!(scenario_name, &block) }
226
+
227
+ before(:example) { allow(scenario_builder).to receive(:add_stub!).and_yield(stub_builder) }
228
+
229
+ it "requests the stub builder invoke the provided block" do
230
+ expect(stub_builder).to receive(:invoke).and_yield
231
+ expect(block_verifier).to receive(:verify)
232
+
233
+ subject
234
+ end
214
235
 
215
- subject
216
236
  end
217
237
 
218
238
  end
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.19.0
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ueckerman