http_stub 0.22.0 → 0.22.2

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
  SHA1:
3
- metadata.gz: aca138df9424e75479a87d7f172fec131427ae8e
4
- data.tar.gz: 3bee3b4a46fcdc888e23bd5458727173a68f7488
3
+ metadata.gz: e4c4645eda720411e136a1e6b217cc9ee3fde9f2
4
+ data.tar.gz: 5b6592c82b4e506028076c326b39fc6d0214dbf4
5
5
  SHA512:
6
- metadata.gz: c0de2e43d78065a51a6fc10faf2e919dc916e4a16ac574d3b8c6e69f2d62e558f3cb174f0bed7955248b4844ff2c1cadd9365b54b99bbbcdc492179ed6e7ad35
7
- data.tar.gz: dca38624939a165c2849cd079d3f5865df2fb6606cc8ec1adbe2e9b5b8f074e022bf2d0793a8135a4c9ab177418475bc45f0807ecaace03232e7bc05b0511338
6
+ metadata.gz: 0a5971eca0c6d1e0ade4f7963a00f4259e2fd14d3274d5a1af9ef817b2ea597666f84a445b4bfcb584b369987742ec730ac896710af9c695a685d7e0b4de25be
7
+ data.tar.gz: 11933cc237590fb5b30e6e1f96eef69461d3f7b8281cb44d1f8756261e944330ab54acbcb9d093f08e62e594c60cc6f78822edf3399c3f4b184b3bfe4bdf8d30
data/lib/http_stub.rb CHANGED
@@ -47,7 +47,7 @@ require_relative 'http_stub/server/stub/payload_file_consolidator'
47
47
  require_relative 'http_stub/server/stub/parser'
48
48
  require_relative 'http_stub/server/stub/stub'
49
49
  require_relative 'http_stub/server/stub/empty'
50
- require_relative 'http_stub/server/stub/match/match'
50
+ require_relative 'http_stub/server/stub/match/result'
51
51
  require_relative 'http_stub/server/stub/registry'
52
52
  require_relative 'http_stub/server/stub/controller'
53
53
  require_relative 'http_stub/server/stub'
@@ -11,11 +11,11 @@ module HttpStub
11
11
 
12
12
  def initialize
13
13
  super()
14
- @match_registry = HttpStub::Server::Registry.new("match")
15
- @stub_registry = HttpStub::Server::Stub::Registry.new(@match_registry)
16
- @scenario_registry = HttpStub::Server::Registry.new("scenario")
17
- @stub_controller = HttpStub::Server::Stub::Controller.new(@stub_registry)
18
- @scenario_controller = HttpStub::Server::Scenario::Controller.new(@scenario_registry, @stub_registry)
14
+ @match_result_registry = HttpStub::Server::Registry.new("match result")
15
+ @stub_registry = HttpStub::Server::Stub::Registry.new(@match_result_registry)
16
+ @scenario_registry = HttpStub::Server::Registry.new("scenario")
17
+ @stub_controller = HttpStub::Server::Stub::Controller.new(@stub_registry)
18
+ @scenario_controller = HttpStub::Server::Scenario::Controller.new(@scenario_registry, @stub_registry)
19
19
  end
20
20
 
21
21
  private
@@ -62,7 +62,7 @@ module HttpStub
62
62
  end
63
63
 
64
64
  get "/http_stub/stubs/matches" do
65
- haml :matches, {}, matches: @match_registry.all
65
+ haml :match_results, {}, match_results: @match_result_registry.all
66
66
  end
67
67
 
68
68
  get "/http_stub/stubs/:id" do
@@ -5,7 +5,7 @@ module HttpStub
5
5
 
6
6
  def initialize(model_name)
7
7
  @model_name = model_name
8
- @models = []
8
+ @models = []
9
9
  end
10
10
 
11
11
  def add(model, logger)
@@ -15,7 +15,7 @@ module HttpStub
15
15
  end
16
16
 
17
17
  def replay(request, logger)
18
- stub = @registry.find(request, logger)
18
+ stub = @registry.match(request, logger)
19
19
  stub ? stub.response : HttpStub::Server::Response::NOT_FOUND
20
20
  end
21
21
 
@@ -0,0 +1,20 @@
1
+ module HttpStub
2
+ module Server
3
+ module Stub
4
+ module Match
5
+
6
+ class Result
7
+
8
+ attr_reader :request, :stub
9
+
10
+ def initialize(request, stub)
11
+ @request = request
12
+ @stub = stub
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -4,20 +4,18 @@ module HttpStub
4
4
 
5
5
  class Registry
6
6
 
7
- delegate :add, :concat, :all, to: :@stub_registry
7
+ delegate :add, :concat, :find, :all, to: :@stub_registry
8
8
 
9
- def initialize(match_registry)
10
- @match_registry = match_registry
11
- @stub_registry = HttpStub::Server::Registry.new("stub")
9
+ def initialize(match_result_registry)
10
+ @match_result_registry = match_result_registry
11
+ @stub_registry = HttpStub::Server::Registry.new("stub")
12
12
  end
13
13
 
14
- def find(criteria, logger)
15
- stub = @stub_registry.find(criteria, logger)
16
- if criteria.is_a?(HttpStub::Server::Request)
17
- @match_registry.add(HttpStub::Server::Stub::Match::Match.new(stub, criteria), logger)
18
- stub.triggers.add_to(self, logger) if stub
14
+ def match(request, logger)
15
+ @stub_registry.find(request, logger).tap do |matched_stub|
16
+ @match_result_registry.add(HttpStub::Server::Stub::Match::Result.new(request, matched_stub), logger)
17
+ matched_stub.triggers.add_to(self, logger) if matched_stub
19
18
  end
20
- stub
21
19
  end
22
20
 
23
21
  def remember
@@ -29,7 +27,7 @@ module HttpStub
29
27
  end
30
28
 
31
29
  def clear(logger)
32
- [ @match_registry, @stub_registry ].each { |registry| registry.clear(logger) }
30
+ [ @match_result_registry, @stub_registry ].each { |registry| registry.clear(logger) }
33
31
  end
34
32
 
35
33
  end
@@ -1,4 +1,7 @@
1
1
  %table{ class: :match }
2
+ %tr
3
+ %td Type:
4
+ %td Match
2
5
  %tr
3
6
  %td Request:
4
7
  %td= partial :request, locals: { request: match.request }
@@ -8,6 +11,6 @@
8
11
  %table{ class: :response }
9
12
  = partial :response, locals: { response: match.stub.response }
10
13
  %tr
11
- %td Matched Stub:
14
+ %td Stub:
12
15
  %td
13
- %a{ href: match.stub.stub_uri, class: :stub } Match
16
+ %a{ href: match.stub.stub_uri, class: :stub } Stub
@@ -0,0 +1,7 @@
1
+ %table{ class: :miss }
2
+ %tr
3
+ %td Type:
4
+ %td Miss
5
+ %tr
6
+ %td Request:
7
+ %td= partial :request, locals: { request: miss.request }
@@ -0,0 +1,7 @@
1
+ %h1 Stub Matches & Misses
2
+ - match_results.each do |match_result|
3
+ - if match_result.stub
4
+ = partial :match, locals: { match: match_result }
5
+ - else
6
+ = partial :miss, locals: { miss: match_result }
7
+ %br
@@ -1,3 +1,3 @@
1
1
  module HttpStub
2
- VERSION = "0.22.0".freeze
2
+ VERSION = "0.22.2".freeze
3
3
  end
@@ -41,7 +41,7 @@ describe "Stub match acceptance" do
41
41
 
42
42
  end
43
43
 
44
- shared_context "behaviours of a request that is recorded in the stub match log" do
44
+ shared_context "issues requests of various types" do
45
45
 
46
46
  it "returns a response body that contains the uri of the request" do
47
47
  expect(response.body).to match(/#{escape_html(request_uri)}/)
@@ -107,7 +107,11 @@ describe "Stub match acceptance" do
107
107
  issue_request
108
108
  end
109
109
 
110
- include_context "behaviours of a request that is recorded in the stub match log"
110
+ include_context "issues requests of various types"
111
+
112
+ it "returns a response body that indicates the request matched a stub" do
113
+ expect(response.body).to include("Match")
114
+ end
111
115
 
112
116
  it "returns a response body that contains stub response status" do
113
117
  expect(response.body).to match(/#{escape_html(stub_response_status)}/)
@@ -138,7 +142,11 @@ describe "Stub match acceptance" do
138
142
 
139
143
  before(:example) { issue_request }
140
144
 
141
- it_behaves_like "behaviours of a request that is recorded in the stub match log"
145
+ include_context "issues requests of various types"
146
+
147
+ it "returns a response body that indicates the request did not match a stub" do
148
+ expect(response.body).to include("Miss")
149
+ end
142
150
 
143
151
  end
144
152
 
@@ -148,19 +156,19 @@ describe "Stub match acceptance" do
148
156
 
149
157
  before(:example) { register_stub }
150
158
 
151
- it "should not be recorded in the stub request log" do
159
+ it "returns a response body that does not include the stub configuration request" do
152
160
  expect(response.body).to_not match(/#{request_uri}/)
153
161
  end
154
162
 
155
163
  end
156
164
 
157
- context "when a request has been made configuring a scenarios" do
165
+ context "when a request has been made configuring a scenario" do
158
166
 
159
167
  include_context "registers a stub"
160
168
 
161
169
  before(:example) { register_scenario }
162
170
 
163
- it "should not be recorded in the stub request log" do
171
+ it "returns a response body that does not include the scenario configuration request" do
164
172
  expect(response.body).to_not match(/#{request_uri}/)
165
173
  end
166
174
 
@@ -28,7 +28,7 @@ describe HttpStub::Rake::ServerTasks do
28
28
  end
29
29
 
30
30
  def wait_until_server_has_started
31
- ::Wait.until!("http stub server #{task_args[:name]} started") do
31
+ ::Wait.until!(description: "http stub server #{task_args[:name]} started") do
32
32
  Net::HTTP.get_response("localhost", "/", port)
33
33
  end
34
34
  end
@@ -4,9 +4,9 @@ describe HttpStub::Server::Application do
4
4
  let(:response) { last_response }
5
5
  let(:response_body) { response.body.to_s }
6
6
 
7
- let(:match_registry) { instance_double(HttpStub::Server::Stub::Registry) }
8
- let(:stub_registry) { instance_double(HttpStub::Server::Stub::Registry) }
9
- let(:scenario_registry) { instance_double(HttpStub::Server::Registry) }
7
+ let(:match_result_registry) { instance_double(HttpStub::Server::Registry) }
8
+ let(:stub_registry) { instance_double(HttpStub::Server::Stub::Registry) }
9
+ let(:scenario_registry) { instance_double(HttpStub::Server::Registry) }
10
10
 
11
11
  let(:stub_controller) { instance_double(HttpStub::Server::Stub::Controller) }
12
12
  let(:scenario_controller) { instance_double(HttpStub::Server::Scenario::Controller) }
@@ -16,7 +16,7 @@ describe HttpStub::Server::Application do
16
16
  let(:app) { HttpStub::Server::Application.new! }
17
17
 
18
18
  before(:example) do
19
- allow(HttpStub::Server::Registry).to receive(:new).with("match").and_return(match_registry)
19
+ allow(HttpStub::Server::Registry).to receive(:new).with("match result").and_return(match_result_registry)
20
20
  allow(HttpStub::Server::Registry).to receive(:new).with("scenario").and_return(scenario_registry)
21
21
  allow(HttpStub::Server::Stub::Registry).to receive(:new).and_return(stub_registry)
22
22
  allow(HttpStub::Server::Stub::Controller).to receive(:new).and_return(stub_controller)
@@ -151,12 +151,12 @@ describe HttpStub::Server::Application do
151
151
 
152
152
  context "when a request to list the matches is received" do
153
153
 
154
- let(:found_matches) { [ HttpStub::Server::Stub::Match::MatchFixture.empty ] }
154
+ let(:found_match_results) { [ HttpStub::Server::Stub::Match::ResultFixture.empty ] }
155
155
 
156
156
  subject { get "/http_stub/stubs/matches" }
157
157
 
158
- it "retrieves the matches from the registry" do
159
- expect(match_registry).to receive(:all).and_return(found_matches)
158
+ it "retrieves the match results from the registry" do
159
+ expect(match_result_registry).to receive(:all).and_return(found_match_results)
160
160
 
161
161
  subject
162
162
  end
@@ -56,9 +56,11 @@ describe HttpStub::Server::Stub::Controller do
56
56
 
57
57
  subject { controller.replay(request, logger) }
58
58
 
59
- describe "when a stub has been registered that should be replayed for the request" do
59
+ before(:example) { allow(registry).to receive(:match).with(request, logger).and_return(matched_stub) }
60
60
 
61
- before(:example) { allow(registry).to receive(:find).with(request, logger).and_return(the_stub) }
61
+ describe "when a stub has been registered that matches the request" do
62
+
63
+ let(:matched_stub) { the_stub }
62
64
 
63
65
  it "returns the stubs response" do
64
66
  expect(the_stub).to receive(:response).and_return(response)
@@ -68,9 +70,9 @@ describe HttpStub::Server::Stub::Controller do
68
70
 
69
71
  end
70
72
 
71
- describe "when no stub should be replayed for the request" do
73
+ describe "when no stub matches the request" do
72
74
 
73
- before(:example) { allow(registry).to receive(:find).with(request, logger).and_return(nil) }
75
+ let(:matched_stub) { nil }
74
76
 
75
77
  it "returns a not found response" do
76
78
  expect(subject).to eql(HttpStub::Server::Response::NOT_FOUND)
@@ -0,0 +1,24 @@
1
+ describe HttpStub::Server::Stub::Match::Result do
2
+
3
+ let(:request) { instance_double(HttpStub::Server::Request) }
4
+ let(:stub) { instance_double(HttpStub::Server::Stub::Stub) }
5
+
6
+ let(:stub_match) { HttpStub::Server::Stub::Match::Result.new(request, stub) }
7
+
8
+ describe "#request" do
9
+
10
+ it "exposes the provided value" do
11
+ expect(stub_match.request).to eql(request)
12
+ end
13
+
14
+ end
15
+
16
+ describe "#stub" do
17
+
18
+ it "exposes the provided value" do
19
+ expect(stub_match.stub).to eql(stub)
20
+ end
21
+
22
+ end
23
+
24
+ end
@@ -1,11 +1,11 @@
1
1
  describe HttpStub::Server::Stub::Registry do
2
2
 
3
- let(:match_registry) { instance_double(HttpStub::Server::Registry) }
3
+ let(:match_result_registry) { instance_double(HttpStub::Server::Registry) }
4
4
  let(:underlying_stub_registry) { instance_double(HttpStub::Server::Registry) }
5
5
 
6
- let(:logger) { instance_double(Logger) }
6
+ let(:logger) { instance_double(Logger) }
7
7
 
8
- let(:stub_registry) { HttpStub::Server::Stub::Registry.new(match_registry) }
8
+ let(:stub_registry) { HttpStub::Server::Stub::Registry.new(match_result_registry) }
9
9
 
10
10
  before(:example) { allow(HttpStub::Server::Registry).to receive(:new).and_return(underlying_stub_registry) }
11
11
 
@@ -39,114 +39,109 @@ describe HttpStub::Server::Stub::Registry do
39
39
 
40
40
  describe "#find" do
41
41
 
42
- let(:triggers) { instance_double(HttpStub::Server::Stub::Triggers, add_to: nil) }
43
- let(:stub) { instance_double(HttpStub::Server::Stub::Stub, triggers: triggers) }
42
+ let(:id) { SecureRandom.uuid }
44
43
 
45
- subject { stub_registry.find(criteria, logger) }
44
+ subject { stub_registry.find(id, logger) }
46
45
 
47
- shared_examples_for "an approach to finding a stub in the registry" do
48
-
49
- it "delegates to an underlying simple registry to find based on the criteria" do
50
- expect(underlying_stub_registry).to receive(:find).with(criteria, logger)
51
-
52
- subject
53
- end
46
+ it "delegates to an underlying simple registry" do
47
+ expect(underlying_stub_registry).to receive(:find).with(id, logger)
54
48
 
55
- context "when a stub is found" do
49
+ subject
50
+ end
56
51
 
57
- before(:example) { allow(underlying_stub_registry).to receive(:find).and_return(stub) }
52
+ end
58
53
 
59
- it "returns the stub found in the underlying stub registry" do
60
- expect(subject).to eql(stub)
61
- end
54
+ describe "#match" do
62
55
 
63
- end
56
+ let(:request) { HttpStub::Server::RequestFixture.create }
64
57
 
65
- context "when a stub is not found" do
58
+ let(:triggers) { instance_double(HttpStub::Server::Stub::Triggers, add_to: nil) }
59
+ let(:stub) { instance_double(HttpStub::Server::Stub::Stub, triggers: triggers) }
60
+ let(:found_stub) { nil }
61
+ let(:match_result) { instance_double(HttpStub::Server::Stub::Match::Result) }
66
62
 
67
- before(:example) { allow(underlying_stub_registry).to receive(:find).and_return(nil) }
63
+ subject { stub_registry.match(request, logger) }
68
64
 
69
- it "returns the result from the underlying registry" do
70
- expect(subject).to eql(nil)
71
- end
65
+ before(:example) do
66
+ allow(underlying_stub_registry).to receive(:find).and_return(found_stub)
67
+ allow(HttpStub::Server::Stub::Match::Result).to receive(:new).and_return(match_result)
68
+ allow(match_result_registry).to receive(:add)
69
+ end
72
70
 
73
- end
71
+ it "finds a matching stub in the underlying simple registry based on the request" do
72
+ expect(underlying_stub_registry).to receive(:find).with(request, logger)
74
73
 
74
+ subject
75
75
  end
76
76
 
77
- context "when a request is provided" do
77
+ context "when a stub is found" do
78
78
 
79
- let(:request) { HttpStub::Server::RequestFixture.create }
80
- let(:criteria) { request }
79
+ let(:found_stub) { stub }
81
80
 
82
- let(:stub_match) { instance_double(HttpStub::Server::Stub::Match::Match) }
81
+ it "creates a match containing the request and the stub" do
82
+ expect(HttpStub::Server::Stub::Match::Result).to receive(:new).with(request, stub)
83
83
 
84
- before(:example) do
85
- allow(HttpStub::Server::Stub::Match::Match).to receive(:new).and_return(stub_match)
86
- allow(match_registry).to receive(:add)
84
+ subject
87
85
  end
88
86
 
89
- it_behaves_like "an approach to finding a stub in the registry"
87
+ it "adds the match result to the match result registry" do
88
+ expect(match_result_registry).to receive(:add).with(match_result, logger)
90
89
 
91
- context "when a stub is found" do
90
+ subject
91
+ end
92
92
 
93
- before(:example) { allow(underlying_stub_registry).to receive(:find).and_return(stub) }
93
+ it "adds the stubs triggers to the underlying stub registry" do
94
+ expect(triggers).to receive(:add_to).with(stub_registry, logger)
94
95
 
95
- it "creates a match containing the stub and request" do
96
- expect(HttpStub::Server::Stub::Match::Match).to receive(:new).with(stub, request)
96
+ subject
97
+ end
97
98
 
98
- subject
99
- end
99
+ it "returns the stub found in the underlying stub registry" do
100
+ expect(subject).to eql(stub)
101
+ end
100
102
 
101
- it "adds the match to the match registry" do
102
- expect(match_registry).to receive(:add).with(stub_match, logger)
103
+ end
103
104
 
104
- subject
105
- end
105
+ context "when a stub is not found" do
106
106
 
107
- it "adds the stubs triggers to the underlying stub registry" do
108
- expect(triggers).to receive(:add_to).with(stub_registry, logger)
107
+ let(:found_stub) { nil }
109
108
 
110
- subject
111
- end
109
+ it "creates a match result with a nil stub" do
110
+ expect(HttpStub::Server::Stub::Match::Result).to receive(:new).with(request, nil)
112
111
 
112
+ subject
113
113
  end
114
114
 
115
- context "when a stub is not found" do
116
-
117
- before(:example) { allow(underlying_stub_registry).to receive(:find).and_return(nil) }
118
-
119
- it "creates a match with a nil stub" do
120
- expect(HttpStub::Server::Stub::Match::Match).to receive(:new).with(nil, request)
115
+ it "adds the match result to the match result registry" do
116
+ expect(match_result_registry).to receive(:add).with(match_result, logger)
121
117
 
122
- subject
123
- end
124
-
125
- it "adds the match to the match registry" do
126
- expect(match_registry).to receive(:add).with(stub_match, logger)
127
-
128
- subject
129
- end
118
+ subject
119
+ end
130
120
 
121
+ it "returns the result from the underlying registry" do
122
+ expect(subject).to eql(nil)
131
123
  end
132
124
 
133
125
  end
134
126
 
135
- context "when an id is provided" do
127
+ end
128
+
129
+ describe "#all" do
136
130
 
137
- let(:id) { SecureRandom.uuid }
138
- let(:criteria) { id }
131
+ let(:stubs) { (1..3).map { instance_double(HttpStub::Server::Stub::Stub) } }
139
132
 
140
- before(:example) { allow(underlying_stub_registry).to receive(:find).and_return(nil) }
133
+ subject { stub_registry.all }
141
134
 
142
- it_behaves_like "an approach to finding a stub in the registry"
135
+ it "delegates to an underlying simple registry" do
136
+ expect(underlying_stub_registry).to receive(:all)
143
137
 
144
- it "does not add a match to the match registry" do
145
- expect(match_registry).to_not receive(:add)
138
+ subject
139
+ end
146
140
 
147
- subject
148
- end
141
+ it "returns the result from the underlying registry" do
142
+ allow(underlying_stub_registry).to receive(:all).and_return(stubs)
149
143
 
144
+ expect(subject).to eql(stubs)
150
145
  end
151
146
 
152
147
  end
@@ -184,33 +179,13 @@ describe HttpStub::Server::Stub::Registry do
184
179
 
185
180
  end
186
181
 
187
- describe "#all" do
188
-
189
- let(:stubs) { (1..3).map { instance_double(HttpStub::Server::Stub::Stub) } }
190
-
191
- subject { stub_registry.all }
192
-
193
- it "delegates to an underlying simple registry" do
194
- expect(underlying_stub_registry).to receive(:all)
195
-
196
- subject
197
- end
198
-
199
- it "returns the result from the underlying registry" do
200
- allow(underlying_stub_registry).to receive(:all).and_return(stubs)
201
-
202
- expect(subject).to eql(stubs)
203
- end
204
-
205
- end
206
-
207
182
  describe "#clear" do
208
183
 
209
184
  subject { stub_registry.clear(logger) }
210
185
 
211
186
  before(:example) do
212
187
  allow(underlying_stub_registry).to receive(:clear)
213
- allow(match_registry).to receive(:clear)
188
+ allow(match_result_registry).to receive(:clear)
214
189
  end
215
190
 
216
191
  it "clears the underlying simple registry" do
@@ -219,8 +194,8 @@ describe HttpStub::Server::Stub::Registry do
219
194
  subject
220
195
  end
221
196
 
222
- it "clears the match registry" do
223
- expect(match_registry).to receive(:clear).with(logger)
197
+ it "clears the match result registry" do
198
+ expect(match_result_registry).to receive(:clear).with(logger)
224
199
 
225
200
  subject
226
201
  end
data/spec/spec_helper.rb CHANGED
@@ -46,7 +46,7 @@ end
46
46
 
47
47
  require_relative 'support/http_stub/server/request_fixture'
48
48
  require_relative 'support/http_stub/server/scenario/scenario_fixture'
49
- require_relative 'support/http_stub/server/stub/match/match_fixture'
49
+ require_relative 'support/http_stub/server/stub/match/result_fixture'
50
50
  require_relative 'support/http_stub/stub_fixture'
51
51
  require_relative 'support/http_stub/scenario_fixture'
52
52
  require_relative 'support/http_stub/empty_configurer'
@@ -3,10 +3,10 @@ module HttpStub
3
3
  module Stub
4
4
  module Match
5
5
 
6
- class MatchFixture
6
+ class ResultFixture
7
7
 
8
8
  def self.empty
9
- HttpStub::Server::Stub::Match::Match.new(nil, HttpStub::Server::RequestFixture.create)
9
+ HttpStub::Server::Stub::Match::Result.new(HttpStub::Server::RequestFixture.create, nil)
10
10
  end
11
11
 
12
12
  end
@@ -3,7 +3,7 @@ shared_context "server integration" do
3
3
 
4
4
  before(:context) do
5
5
  @pid = Process.spawn("rake example_server:start:foreground --trace")
6
- ::Wait.until!("http stub server started") { Net::HTTP.get_response(server_host, "/", server_port) }
6
+ ::Wait.until!(description: "http stub server started") { Net::HTTP.get_response(server_host, "/", server_port) }
7
7
  end
8
8
 
9
9
  after(:context) { Process.kill(9, @pid) }
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.22.0
4
+ version: 0.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ueckerman
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-14 00:00:00.000000000 Z
12
+ date: 2016-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '11.1'
20
+ version: '10.4'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '11.1'
27
+ version: '10.4'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: sinatra
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -241,14 +241,14 @@ dependencies:
241
241
  requirements:
242
242
  - - "~>"
243
243
  - !ruby/object:Gem::Version
244
- version: '0.1'
244
+ version: '0.3'
245
245
  type: :development
246
246
  prerelease: false
247
247
  version_requirements: !ruby/object:Gem::Requirement
248
248
  requirements:
249
249
  - - "~>"
250
250
  - !ruby/object:Gem::Version
251
- version: '0.1'
251
+ version: '0.3'
252
252
  - !ruby/object:Gem::Dependency
253
253
  name: codeclimate-test-reporter
254
254
  requirement: !ruby/object:Gem::Requirement
@@ -323,9 +323,9 @@ files:
323
323
  - "./lib/http_stub/server/stub/empty.rb"
324
324
  - "./lib/http_stub/server/stub/match/exact_value_matcher.rb"
325
325
  - "./lib/http_stub/server/stub/match/hash_with_string_value_matchers.rb"
326
- - "./lib/http_stub/server/stub/match/match.rb"
327
326
  - "./lib/http_stub/server/stub/match/omitted_value_matcher.rb"
328
327
  - "./lib/http_stub/server/stub/match/regexp_value_matcher.rb"
328
+ - "./lib/http_stub/server/stub/match/result.rb"
329
329
  - "./lib/http_stub/server/stub/match/rule/body.rb"
330
330
  - "./lib/http_stub/server/stub/match/rule/headers.rb"
331
331
  - "./lib/http_stub/server/stub/match/rule/json_body.rb"
@@ -347,6 +347,7 @@ files:
347
347
  - "./lib/http_stub/server/views/_activate_scenario.haml"
348
348
  - "./lib/http_stub/server/views/_file_response.haml"
349
349
  - "./lib/http_stub/server/views/_match.haml"
350
+ - "./lib/http_stub/server/views/_miss.haml"
350
351
  - "./lib/http_stub/server/views/_request.haml"
351
352
  - "./lib/http_stub/server/views/_response.haml"
352
353
  - "./lib/http_stub/server/views/_stub.haml"
@@ -354,7 +355,7 @@ files:
354
355
  - "./lib/http_stub/server/views/application.sass"
355
356
  - "./lib/http_stub/server/views/index.haml"
356
357
  - "./lib/http_stub/server/views/layout.haml"
357
- - "./lib/http_stub/server/views/matches.haml"
358
+ - "./lib/http_stub/server/views/match_results.haml"
358
359
  - "./lib/http_stub/server/views/scenario.haml"
359
360
  - "./lib/http_stub/server/views/scenarios.haml"
360
361
  - "./lib/http_stub/server/views/stub.haml"
@@ -423,9 +424,9 @@ files:
423
424
  - "./spec/lib/http_stub/server/stub/empty_spec.rb"
424
425
  - "./spec/lib/http_stub/server/stub/match/exact_value_matcher_spec.rb"
425
426
  - "./spec/lib/http_stub/server/stub/match/hash_with_string_value_matchers_spec.rb"
426
- - "./spec/lib/http_stub/server/stub/match/match_spec.rb"
427
427
  - "./spec/lib/http_stub/server/stub/match/omitted_value_matcher_spec.rb"
428
428
  - "./spec/lib/http_stub/server/stub/match/regexp_value_matcher_spec.rb"
429
+ - "./spec/lib/http_stub/server/stub/match/result_spec.rb"
429
430
  - "./spec/lib/http_stub/server/stub/match/rule/body_spec.rb"
430
431
  - "./spec/lib/http_stub/server/stub/match/rule/headers_spec.rb"
431
432
  - "./spec/lib/http_stub/server/stub/match/rule/json_body_spec.rb"
@@ -453,7 +454,7 @@ files:
453
454
  - "./spec/support/http_stub/scenario_fixture.rb"
454
455
  - "./spec/support/http_stub/server/request_fixture.rb"
455
456
  - "./spec/support/http_stub/server/scenario/scenario_fixture.rb"
456
- - "./spec/support/http_stub/server/stub/match/match_fixture.rb"
457
+ - "./spec/support/http_stub/server/stub/match/result_fixture.rb"
457
458
  - "./spec/support/http_stub/stub_fixture.rb"
458
459
  - "./spec/support/server_integration.rb"
459
460
  homepage: http://github.com/MYOB-Technology/http_stub
@@ -544,9 +545,9 @@ test_files:
544
545
  - "./spec/lib/http_stub/server/stub/empty_spec.rb"
545
546
  - "./spec/lib/http_stub/server/stub/match/exact_value_matcher_spec.rb"
546
547
  - "./spec/lib/http_stub/server/stub/match/hash_with_string_value_matchers_spec.rb"
547
- - "./spec/lib/http_stub/server/stub/match/match_spec.rb"
548
548
  - "./spec/lib/http_stub/server/stub/match/omitted_value_matcher_spec.rb"
549
549
  - "./spec/lib/http_stub/server/stub/match/regexp_value_matcher_spec.rb"
550
+ - "./spec/lib/http_stub/server/stub/match/result_spec.rb"
550
551
  - "./spec/lib/http_stub/server/stub/match/rule/body_spec.rb"
551
552
  - "./spec/lib/http_stub/server/stub/match/rule/headers_spec.rb"
552
553
  - "./spec/lib/http_stub/server/stub/match/rule/json_body_spec.rb"
@@ -574,6 +575,6 @@ test_files:
574
575
  - "./spec/support/http_stub/scenario_fixture.rb"
575
576
  - "./spec/support/http_stub/server/request_fixture.rb"
576
577
  - "./spec/support/http_stub/server/scenario/scenario_fixture.rb"
577
- - "./spec/support/http_stub/server/stub/match/match_fixture.rb"
578
+ - "./spec/support/http_stub/server/stub/match/result_fixture.rb"
578
579
  - "./spec/support/http_stub/stub_fixture.rb"
579
580
  - "./spec/support/server_integration.rb"
@@ -1,20 +0,0 @@
1
- module HttpStub
2
- module Server
3
- module Stub
4
- module Match
5
-
6
- class Match
7
-
8
- attr_reader :stub, :request
9
-
10
- def initialize(stub, request)
11
- @stub = stub || HttpStub::Server::Stub::Empty::INSTANCE
12
- @request = request
13
- end
14
-
15
- end
16
-
17
- end
18
- end
19
- end
20
- end
@@ -1,4 +0,0 @@
1
- %h1 Stub Matches & Misses
2
- - matches.each do |match|
3
- = partial :match, locals: { match: match }
4
- %br
@@ -1,40 +0,0 @@
1
- describe HttpStub::Server::Stub::Match::Match do
2
-
3
- let(:stub) { instance_double(HttpStub::Server::Stub::Stub) }
4
- let(:request) { instance_double(HttpStub::Server::Request) }
5
-
6
- let(:stub_match) { HttpStub::Server::Stub::Match::Match.new(stub, request) }
7
-
8
- describe "#stub" do
9
-
10
- subject { stub_match.stub }
11
-
12
- context "when a stub is provided" do
13
-
14
- it "exposes the provided value" do
15
- expect(subject).to eql(stub)
16
- end
17
-
18
- end
19
-
20
- context "when a stub is not provided" do
21
-
22
- let(:stub_match) { HttpStub::Server::Stub::Match::Match.new(nil, request) }
23
-
24
- it "returns the empty stub" do
25
- expect(subject).to eql(HttpStub::Server::Stub::Empty::INSTANCE)
26
- end
27
-
28
- end
29
-
30
- end
31
-
32
- describe "#request" do
33
-
34
- it "exposes the provided value" do
35
- expect(stub_match.request).to eql(request)
36
- end
37
-
38
- end
39
-
40
- end