http_stub 0.14.0.rc2 → 0.14.0.rc3

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: 6d5d1e764366bda9d5f710c4938843dd56cfe795
4
- data.tar.gz: e45dbffa5460da77bb50c24bf57eea45a43afe95
3
+ metadata.gz: ae3af84821967d62af59d061889031ec39fdd2a2
4
+ data.tar.gz: 60a07c4687d3dd2f0a5490c1059f30335ec28b87
5
5
  SHA512:
6
- metadata.gz: 7e2c3a0c793fb39fe1a6c1ab1a88de29da1f086370b0e98836f8366b5ad523ccc228a4ca2fa208bcd2576ac8eb27fe8f8689cd247c9b2a12c224c310491503e9
7
- data.tar.gz: 7e8282e64d9ad2c8e627ebe5ceffcbeb8df653cdd5f9915bab7a4b17ae28bbdf003376fbf9fa8088fc7688d30e88a6e274c525eb5e75fd6e3e827af7b2908e5d
6
+ metadata.gz: 1379954004bf0aee00104bc4efc8212e1e79ca491ee5d2efe596d0bf0de54a9365b5524368aa943ceb5fb13de545c280b633d0b0ab2629c77d01452681395b50
7
+ data.tar.gz: dc7d720c7a7aa31b1a75cf0fdab59761c5e6c6da3ceaa0cd06d3c11015acd2c8bcac38431d69b7c5543a4b52fa2f4deb1db889bdd8c6323ac687241b7ad2e5e1
@@ -22,7 +22,7 @@ module HttpStub
22
22
 
23
23
  def stub_activator(activation_uri, stub_uri, options)
24
24
  stub_server.add_activator! do |activator|
25
- activator.path(activation_uri)
25
+ activator.on(activation_uri)
26
26
  add_stub_options_to_builder(activator, stub_uri, options)
27
27
  end
28
28
  end
@@ -46,8 +46,8 @@ module HttpStub
46
46
  private
47
47
 
48
48
  def add_stub_options_to_builder(stub, uri, options)
49
- stub.match_request(uri, options.slice(:method, :headers, :parameters))
50
- stub.with_response(options[:response])
49
+ stub.match_requests(uri, options.slice(:method, :headers, :parameters))
50
+ stub.respond_with(options[:response])
51
51
  end
52
52
 
53
53
  end
@@ -4,13 +4,13 @@ module HttpStub
4
4
 
5
5
  class StubActivatorPayloadBuilder
6
6
 
7
- delegate :match_request, :with_response, :and_add_stub, :and_add_stubs, to: :@stub_payload_builder
7
+ delegate :match_requests, :respond_with, :and_add_stub, :and_add_stubs, to: :@stub_payload_builder
8
8
 
9
9
  def initialize
10
10
  @stub_payload_builder = HttpStub::Configurer::Request::StubPayloadBuilder.new
11
11
  end
12
12
 
13
- def path(uri)
13
+ def on(uri)
14
14
  @activation_uri = uri
15
15
  end
16
16
 
@@ -8,12 +8,12 @@ module HttpStub
8
8
  @args = { triggers: [] }
9
9
  end
10
10
 
11
- def match_request(uri, args={})
11
+ def match_requests(uri, args={})
12
12
  @uri = uri
13
13
  @args.merge!(args)
14
14
  end
15
15
 
16
- def with_response(args)
16
+ def respond_with(args)
17
17
  @args.merge!(response: args)
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module HttpStub
2
- VERSION = "0.14.0.rc2"
2
+ VERSION = "0.14.0.rc3"
3
3
  end
@@ -12,20 +12,20 @@ describe HttpStub::Configurer::DeprecatedDSL do
12
12
  let(:options) { { method: method, headers: headers, parameters: parameters, response: response } }
13
13
 
14
14
  before(:example) do
15
- allow(builder).to receive(:match_request)
16
- allow(builder).to receive(:with_response)
15
+ allow(builder).to receive(:match_requests)
16
+ allow(builder).to receive(:respond_with)
17
17
  end
18
18
 
19
- it "causes the builder being added to match on the provided uri" do
20
- expect(builder).to receive(:match_request).with(stub_uri, anything)
19
+ it "causes the builder being added to match requests on the provided uri" do
20
+ expect(builder).to receive(:match_requests).with(stub_uri, anything)
21
21
 
22
22
  subject
23
23
  end
24
24
 
25
25
  context "when a method is provided" do
26
26
 
27
- it "causes the builder being added to match on the provided method" do
28
- expect(builder).to receive(:match_request).with(anything, hash_including(method: method))
27
+ it "causes the builder being added to match requests on the provided method" do
28
+ expect(builder).to receive(:match_requests).with(anything, hash_including(method: method))
29
29
 
30
30
  subject
31
31
  end
@@ -36,8 +36,8 @@ describe HttpStub::Configurer::DeprecatedDSL do
36
36
 
37
37
  let(:options) { {} }
38
38
 
39
- it "causes the builder being added to not match on method" do
40
- expect(builder).to receive(:match_request).with(anything, hash_excluding(:method))
39
+ it "causes the builder being added to not match requests based on method" do
40
+ expect(builder).to receive(:match_requests).with(anything, hash_excluding(:method))
41
41
 
42
42
  subject
43
43
  end
@@ -46,8 +46,8 @@ describe HttpStub::Configurer::DeprecatedDSL do
46
46
 
47
47
  context "when parameters are provided" do
48
48
 
49
- it "causes the builder being added to match on the provided parameters" do
50
- expect(builder).to receive(:match_request).with(anything, hash_including(parameters: parameters))
49
+ it "causes the builder being added to match requests on the provided parameters" do
50
+ expect(builder).to receive(:match_requests).with(anything, hash_including(parameters: parameters))
51
51
 
52
52
  subject
53
53
  end
@@ -58,8 +58,8 @@ describe HttpStub::Configurer::DeprecatedDSL do
58
58
 
59
59
  let(:options) { {} }
60
60
 
61
- it "causes the builder being added to not match on parameters" do
62
- expect(builder).to receive(:match_request).with(anything, hash_excluding(:parameters))
61
+ it "causes the builder being added to not match requests based on parameters" do
62
+ expect(builder).to receive(:match_requests).with(anything, hash_excluding(:parameters))
63
63
 
64
64
  subject
65
65
  end
@@ -68,8 +68,8 @@ describe HttpStub::Configurer::DeprecatedDSL do
68
68
 
69
69
  context "when headers are provided" do
70
70
 
71
- it "causes the builder being added to match on the provided headers" do
72
- expect(builder).to receive(:match_request).with(anything, hash_including(headers: headers))
71
+ it "causes the builder being added to match requests on the provided headers" do
72
+ expect(builder).to receive(:match_requests).with(anything, hash_including(headers: headers))
73
73
 
74
74
  subject
75
75
  end
@@ -80,8 +80,8 @@ describe HttpStub::Configurer::DeprecatedDSL do
80
80
 
81
81
  let(:options) { {} }
82
82
 
83
- it "causes the builder being added to not match on headers" do
84
- expect(builder).to receive(:match_request).with(anything, hash_excluding(:headers))
83
+ it "causes the builder being added to not match requests based on headers" do
84
+ expect(builder).to receive(:match_requests).with(anything, hash_excluding(:headers))
85
85
 
86
86
  subject
87
87
  end
@@ -89,7 +89,7 @@ describe HttpStub::Configurer::DeprecatedDSL do
89
89
  end
90
90
 
91
91
  it "adds the provided response data to the builder" do
92
- expect(builder).to receive(:with_response).with(response)
92
+ expect(builder).to receive(:respond_with).with(response)
93
93
 
94
94
  subject
95
95
  end
@@ -170,7 +170,7 @@ describe HttpStub::Configurer::DeprecatedDSL do
170
170
 
171
171
  before(:example) do
172
172
  allow(stub_server).to receive(:add_activator!).and_yield(builder)
173
- allow(builder).to receive(:path)
173
+ allow(builder).to receive(:on)
174
174
  end
175
175
 
176
176
  it "adds an activator to the stub server" do
@@ -180,7 +180,7 @@ describe HttpStub::Configurer::DeprecatedDSL do
180
180
  end
181
181
 
182
182
  it "causes the builder being added to activate on the provided uri" do
183
- expect(builder).to receive(:path).with(activation_uri)
183
+ expect(builder).to receive(:on).with(activation_uri)
184
184
 
185
185
  subject
186
186
  end
@@ -11,22 +11,22 @@ describe HttpStub::Configurer::Request::StubActivatorPayloadBuilder do
11
11
  allow(HttpStub::Configurer::Request::StubPayloadBuilder).to receive(:new).and_return(stub_builder)
12
12
  end
13
13
 
14
- describe "#match_request" do
14
+ describe "#match_requests" do
15
15
 
16
16
  it "delegates to a stub payload builder" do
17
- expect(stub_builder).to receive(:match_request).with(uri, request_options)
17
+ expect(stub_builder).to receive(:match_requests).with(uri, request_options)
18
18
 
19
- builder.match_request(uri, request_options)
19
+ builder.match_requests(uri, request_options)
20
20
  end
21
21
 
22
22
  end
23
23
 
24
- describe "#with_response" do
24
+ describe "#respond_with" do
25
25
 
26
26
  it "delegates to a stub payload builder" do
27
- expect(stub_builder).to receive(:with_response).with(response_options)
27
+ expect(stub_builder).to receive(:respond_with).with(response_options)
28
28
 
29
- builder.with_response(response_options)
29
+ builder.respond_with(response_options)
30
30
  end
31
31
 
32
32
  end
@@ -59,11 +59,11 @@ describe HttpStub::Configurer::Request::StubActivatorPayloadBuilder do
59
59
 
60
60
  subject { builder.build }
61
61
 
62
- context "when a path is established" do
62
+ context "when a path on which the activator is activated is established" do
63
63
 
64
64
  let(:activation_uri) { "http://some/activation/uri" }
65
65
 
66
- before(:example) { builder.path(activation_uri) }
66
+ before(:example) { builder.on(activation_uri) }
67
67
 
68
68
  it "returns a payload that includes the activation uri" do
69
69
  expect(subject).to include(activation_uri: activation_uri)
@@ -37,8 +37,8 @@ describe HttpStub::Configurer::Request::StubPayloadBuilder do
37
37
  before(:example) do
38
38
  allow(HttpStub::Configurer::Request::ControllableValue).to receive(:format)
39
39
 
40
- builder.match_request(uri, request_options)
41
- builder.with_response(response_options)
40
+ builder.match_requests(uri, request_options)
41
+ builder.respond_with(response_options)
42
42
  end
43
43
 
44
44
  context "when request header is provided" do
@@ -500,16 +500,16 @@ describe HttpStub::Configurer, "when the server is running" do
500
500
  let(:triggers) do
501
501
  (1..3).map do |trigger_number|
502
502
  stub_server.build_stub do |stub|
503
- stub.match_request("/triggered_stub_#{trigger_number}", method: :get)
504
- stub.with_response(status: 200 + trigger_number, body: "Triggered stub body #{trigger_number}")
503
+ stub.match_requests("/triggered_stub_#{trigger_number}", method: :get)
504
+ stub.respond_with(status: 200 + trigger_number, body: "Triggered stub body #{trigger_number}")
505
505
  end
506
506
  end
507
507
  end
508
508
 
509
509
  before(:example) do
510
510
  stub_server.add_stub! do |stub|
511
- stub.match_request("/stub_with_triggers", method: :get)
512
- stub.with_response(body: "Trigger stub body")
511
+ stub.match_requests("/stub_with_triggers", method: :get)
512
+ stub.respond_with(body: "Trigger stub body")
513
513
  stub.and_add_stubs(triggers)
514
514
  end
515
515
  end
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,7 @@ Bundler.require(:development)
4
4
  SimpleCov.start do
5
5
  add_filter "/spec/"
6
6
  add_filter "/vendor/"
7
- minimum_coverage 99.4
7
+ minimum_coverage 99.41
8
8
  refuse_coverage_drop
9
9
  end if ENV["coverage"]
10
10
 
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.14.0.rc2
4
+ version: 0.14.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ueckerman