http_stub 0.24.3 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/http_stub.rb +8 -2
  3. data/lib/http_stub/server/application/application.rb +16 -4
  4. data/lib/http_stub/server/request/request.rb +6 -1
  5. data/lib/http_stub/server/response.rb +5 -3
  6. data/lib/http_stub/server/scenario/controller.rb +2 -2
  7. data/lib/http_stub/server/scenario/parser.rb +1 -3
  8. data/lib/http_stub/server/stub/controller.rb +8 -6
  9. data/lib/http_stub/server/stub/empty.rb +9 -5
  10. data/lib/http_stub/server/stub/match/controller.rb +22 -0
  11. data/lib/http_stub/server/stub/match/{result.rb → match.rb} +9 -1
  12. data/lib/http_stub/server/stub/match/miss.rb +19 -0
  13. data/lib/http_stub/server/stub/match/rules.rb +33 -0
  14. data/lib/http_stub/server/stub/parser.rb +1 -1
  15. data/lib/http_stub/server/stub/payload.rb +20 -0
  16. data/lib/http_stub/server/stub/payload/base_uri_modifier.rb +17 -0
  17. data/lib/http_stub/server/stub/payload/response_body_modifier.rb +19 -0
  18. data/lib/http_stub/server/stub/response/base.rb +5 -1
  19. data/lib/http_stub/server/stub/response/file.rb +5 -0
  20. data/lib/http_stub/server/stub/response/text.rb +4 -0
  21. data/lib/http_stub/server/stub/stub.rb +8 -18
  22. data/lib/http_stub/server/stub/triggers.rb +1 -1
  23. data/lib/http_stub/server/views/_activate_scenario.haml +17 -4
  24. data/lib/http_stub/server/views/_stub.haml +2 -2
  25. data/lib/http_stub/server/views/{_match.haml → _stub_match.haml} +1 -1
  26. data/lib/http_stub/server/views/_stub_miss.haml +3 -0
  27. data/lib/http_stub/server/views/index.haml +4 -2
  28. data/lib/http_stub/server/views/stub_matches.haml +4 -0
  29. data/lib/http_stub/server/views/stub_misses.haml +4 -0
  30. data/lib/http_stub/version.rb +1 -1
  31. data/spec/acceptance/stub_match_last_spec.rb +170 -0
  32. data/spec/acceptance/stub_match_list_spec.rb +115 -0
  33. data/spec/acceptance/stub_miss_list_spec.rb +58 -0
  34. data/spec/lib/http_stub/server/application/application_spec.rb +57 -13
  35. data/spec/lib/http_stub/server/request/request_spec.rb +41 -1
  36. data/spec/lib/http_stub/server/response_spec.rb +18 -12
  37. data/spec/lib/http_stub/server/scenario/controller_spec.rb +4 -4
  38. data/spec/lib/http_stub/server/scenario/parser_spec.rb +30 -27
  39. data/spec/lib/http_stub/server/stub/controller_spec.rb +45 -26
  40. data/spec/lib/http_stub/server/stub/empty_spec.rb +14 -14
  41. data/spec/lib/http_stub/server/stub/match/controller_spec.rb +69 -0
  42. data/spec/lib/http_stub/server/stub/match/match_spec.rb +146 -0
  43. data/spec/lib/http_stub/server/stub/match/miss_spec.rb +15 -0
  44. data/spec/lib/http_stub/server/stub/match/rules_spec.rb +247 -0
  45. data/spec/lib/http_stub/server/stub/parser_spec.rb +12 -14
  46. data/spec/lib/http_stub/server/stub/payload/base_uri_modifier_spec.rb +23 -0
  47. data/spec/lib/http_stub/server/{payload_file_consolidator_spec.rb → stub/payload/response_body_modifier_spec.rb} +22 -14
  48. data/spec/lib/http_stub/server/stub/payload_spec.rb +33 -0
  49. data/spec/lib/http_stub/server/stub/response/base_spec.rb +22 -0
  50. data/spec/lib/http_stub/server/stub/response/file_spec.rb +29 -1
  51. data/spec/lib/http_stub/server/stub/response/text_spec.rb +18 -0
  52. data/spec/lib/http_stub/server/stub/stub_spec.rb +48 -145
  53. data/spec/lib/http_stub/server/stub/triggers_spec.rb +14 -0
  54. data/spec/spec_helper.rb +7 -3
  55. data/spec/support/{configurer_integration.rb → http_stub/configurer_integration.rb} +3 -2
  56. data/spec/support/http_stub/html_view_excluding_request_details.rb +11 -0
  57. data/spec/support/http_stub/html_view_including_request_details.rb +47 -0
  58. data/spec/support/http_stub/server/scenario/scenario_fixture.rb +1 -1
  59. data/spec/support/http_stub/server/stub/match/match_fixture.rb +21 -0
  60. data/spec/support/http_stub/server/stub/match/miss_fixture.rb +17 -0
  61. data/spec/support/{server_integration.rb → http_stub/server_integration.rb} +0 -0
  62. data/spec/support/http_stub/stub_fixture.rb +1 -0
  63. data/spec/support/http_stub/stub_registrator.rb +83 -0
  64. metadata +47 -19
  65. data/lib/http_stub/server/stub/payload_file_consolidator.rb +0 -18
  66. data/lib/http_stub/server/views/_miss.haml +0 -7
  67. data/lib/http_stub/server/views/match_results.haml +0 -7
  68. data/spec/acceptance/stub_match_spec.rb +0 -252
  69. data/spec/lib/http_stub/server/stub/match/result_spec.rb +0 -33
  70. data/spec/support/http_stub/server/stub/match/result_fixture.rb +0 -19
@@ -1,12 +1,14 @@
1
1
  describe HttpStub::Server::Request::Request do
2
2
 
3
+ let(:rack_base_url) { "http://base_url:8888" }
3
4
  let(:rack_path_info) { "/rack/path/info" }
4
5
  let(:rack_request_method) { "some method" }
5
6
  let(:rack_env) { { "some_env_name" => "some env value" } }
6
7
  let(:rack_parameters) { { "some_parameter_name" => "some parameter value" } }
7
8
  let(:rack_body) { "some request body" }
8
9
  let(:rack_request) do
9
- instance_double(Rack::Request, path_info: rack_path_info,
10
+ instance_double(Rack::Request, base_url: rack_base_url,
11
+ path_info: rack_path_info,
10
12
  request_method: rack_request_method,
11
13
  env: rack_env,
12
14
  params: rack_parameters,
@@ -15,6 +17,14 @@ describe HttpStub::Server::Request::Request do
15
17
 
16
18
  let(:server_request) { described_class.new(rack_request) }
17
19
 
20
+ describe "#base_uri" do
21
+
22
+ it "is the rack base url" do
23
+ expect(server_request.base_uri).to eql(rack_base_url)
24
+ end
25
+
26
+ end
27
+
18
28
  describe "#uri" do
19
29
 
20
30
  it "is the rack request path information" do
@@ -81,4 +91,34 @@ describe HttpStub::Server::Request::Request do
81
91
 
82
92
  end
83
93
 
94
+ describe "#to_hash" do
95
+
96
+ subject { server_request.to_hash }
97
+
98
+ describe "supporting creating a JSON representation of the result" do
99
+
100
+ it "contains the requests uri" do
101
+ expect(subject).to include(uri: server_request.uri)
102
+ end
103
+
104
+ it "contains the requests method" do
105
+ expect(subject).to include(method: server_request.method)
106
+ end
107
+
108
+ it "contains the requests headers" do
109
+ expect(subject).to include(headers: server_request.headers)
110
+ end
111
+
112
+ it "contains the requests parameters" do
113
+ expect(subject).to include(parameters: server_request.parameters)
114
+ end
115
+
116
+ it "contains the requests body" do
117
+ expect(subject).to include(body: server_request.body)
118
+ end
119
+
120
+ end
121
+
122
+ end
123
+
84
124
  end
@@ -1,42 +1,48 @@
1
1
  describe HttpStub::Server::Response do
2
2
 
3
- shared_examples_for "a success response" do
3
+ shared_examples_for "an ok response" do
4
4
 
5
5
  it "has a status of 200" do
6
6
  expect(subject.status).to eql(200)
7
7
  end
8
8
 
9
9
  it "has a body containing OK to visually indicate success to those interacting via a browser" do
10
- expect(subject.body).to match(/OK/)
10
+ expect(subject.body).to include("OK")
11
11
  end
12
12
 
13
13
  end
14
14
 
15
- describe "::success" do
15
+ describe "::ok" do
16
16
 
17
- subject { described_class.success }
17
+ subject { described_class.ok }
18
18
 
19
- it_behaves_like "a success response"
19
+ it_behaves_like "an ok response"
20
20
 
21
- context "when headers are provided" do
21
+ context "when options are provided" do
22
22
 
23
23
  let(:headers) { { "response_header_key" => "response header value" } }
24
+ let(:body) { "response body" }
25
+ let(:opts) { { "headers" => headers, "body" => body } }
24
26
 
25
- subject { HttpStub::Server::Response::success(headers) }
27
+ subject { HttpStub::Server::Response::ok(opts) }
26
28
 
27
- it "established the headers" do
29
+ it "establishes any headers provided" do
28
30
  expect(subject.headers).to eql(headers)
29
31
  end
30
32
 
33
+ it "establishes any body provided" do
34
+ expect(subject.body).to eql(body)
35
+ end
36
+
31
37
  end
32
38
 
33
39
  end
34
40
 
35
- describe "::SUCCESS" do
41
+ describe "::OK" do
36
42
 
37
- subject { HttpStub::Server::Response::SUCCESS }
43
+ subject { HttpStub::Server::Response::OK }
38
44
 
39
- it_behaves_like "a success response"
45
+ it_behaves_like "an ok response"
40
46
 
41
47
  end
42
48
 
@@ -49,7 +55,7 @@ describe HttpStub::Server::Response do
49
55
  end
50
56
 
51
57
  it "has a body containing NOT FOUND to visually indicate the response to those interacting via a browser" do
52
- expect(subject.body).to match(/NOT FOUND/)
58
+ expect(subject.body).to include("NOT FOUND")
53
59
  end
54
60
 
55
61
  end
@@ -40,8 +40,8 @@ describe HttpStub::Server::Scenario::Controller do
40
40
  subject
41
41
  end
42
42
 
43
- it "returns a success response" do
44
- expect(subject).to eql(HttpStub::Server::Response::SUCCESS)
43
+ it "returns an ok response" do
44
+ expect(subject).to eql(HttpStub::Server::Response::OK)
45
45
  end
46
46
 
47
47
  end
@@ -68,8 +68,8 @@ describe HttpStub::Server::Scenario::Controller do
68
68
  subject
69
69
  end
70
70
 
71
- it "returns a success response" do
72
- expect(subject).to eql(HttpStub::Server::Response::SUCCESS)
71
+ it "returns an ok response" do
72
+ expect(subject).to eql(HttpStub::Server::Response::OK)
73
73
  end
74
74
 
75
75
  end
@@ -4,56 +4,59 @@ describe HttpStub::Server::Scenario::Parser do
4
4
 
5
5
  describe "::parse" do
6
6
 
7
- let(:parameters) { {} }
8
- let(:body_hash) { {} }
9
- let(:request) do
10
- instance_double(HttpStub::Server::Request::Request, parameters: parameters, body: body_hash.to_json)
11
- end
7
+ let(:payload) { HttpStub::ScenarioFixture.new.server_payload }
8
+ let(:payload_parameter) { payload.to_json }
9
+ let(:parameters) { { "payload" => payload_parameter } }
10
+ let(:request) { instance_double(HttpStub::Server::Request::Request, parameters: parameters) }
11
+
12
+ let(:parsed_payload) { payload.clone }
12
13
 
13
14
  subject { parser.parse(request) }
14
15
 
16
+ before(:example) { allow(JSON).to receive(:parse).and_return(parsed_payload) }
17
+
18
+ it "parses the JSON payload in the request" do
19
+ expect(JSON).to receive(:parse).with(payload_parameter)
20
+
21
+ subject
22
+ end
23
+
24
+ it "returns the modified payload" do
25
+ expect(subject).to eql(parsed_payload)
26
+ end
27
+
15
28
  context "when the request contains many stubs" do
16
29
 
17
- let(:payload) { HttpStub::ScenarioFixture.new.with_stubs!(3).server_payload }
18
- let(:stub_payloads) { payload["stubs"] }
19
- let(:parameters) { { "payload" => payload.to_json } }
30
+ let(:payload) { HttpStub::ScenarioFixture.new.with_stubs!(3).server_payload }
20
31
 
21
- it "consolidates any files into each stub payload" do
22
- stub_payloads.each do |stub_payload|
23
- expect(HttpStub::Server::Stub::PayloadFileConsolidator).to receive(:consolidate!).with(stub_payload, request)
24
- end
32
+ let(:stub_payloads) { payload["stubs"] }
25
33
 
26
- subject
34
+ before(:example) do
35
+ stub_payloads.each { |stub_payload| allow(HttpStub::Server::Stub::Payload).to receive(:modify!) }
27
36
  end
28
37
 
29
- it "consolidates any files in each stub payload" do
30
- stub_payloads.each_with_index.each do |stub_payload|
31
- allow(HttpStub::Server::Stub::PayloadFileConsolidator).to receive(:consolidate!).with(stub_payload, anything)
38
+ it "modifies each stub payload" do
39
+ stub_payloads.each do |stub_payload|
40
+ expect(HttpStub::Server::Stub::Payload).to receive(:modify!).with(stub_payload, request)
32
41
  end
33
42
 
34
- expect(subject).to eql(payload)
43
+ subject
35
44
  end
36
45
 
37
46
  end
38
47
 
39
48
  context "when the request contains one stub" do
40
49
 
41
- let(:payload) { HttpStub::ScenarioFixture.new.with_stubs!(1).server_payload }
50
+ let(:payload) { HttpStub::ScenarioFixture.new.with_stubs!(1).server_payload }
51
+
42
52
  let(:stub_payload) { payload["stubs"].first }
43
- let(:parameters) { { "payload" => payload.to_json } }
44
53
 
45
- it "consolidates any file into the stub payload" do
46
- expect(HttpStub::Server::Stub::PayloadFileConsolidator).to receive(:consolidate!).with(stub_payload, request)
54
+ it "modifies the stub payload" do
55
+ expect(HttpStub::Server::Stub::Payload).to receive(:modify!).with(stub_payload, request)
47
56
 
48
57
  subject
49
58
  end
50
59
 
51
- it "consolidates any file in the stub payload" do
52
- allow(HttpStub::Server::Stub::PayloadFileConsolidator).to receive(:consolidate!).with(stub_payload, anything)
53
-
54
- expect(subject).to eql(payload)
55
- end
56
-
57
60
  end
58
61
 
59
62
  end
@@ -3,14 +3,14 @@ describe HttpStub::Server::Stub::Controller do
3
3
  let(:request) { instance_double(HttpStub::Server::Request::Request) }
4
4
  let(:logger) { instance_double(Logger) }
5
5
  let(:payload) { HttpStub::StubFixture.new.server_payload }
6
- let(:response) { instance_double(HttpStub::Server::Stub::Response::Base) }
7
6
  let(:stub_uri) { "/some/stub/uri" }
8
- let(:the_stub) { instance_double(HttpStub::Server::Stub::Stub, response: response, stub_uri: stub_uri) }
7
+ let(:the_stub) { instance_double(HttpStub::Server::Stub::Stub, uri: stub_uri) }
9
8
 
10
- let(:stub_registry) { instance_double(HttpStub::Server::Stub::Registry).as_null_object }
11
- let(:match_result_registry) { instance_double(HttpStub::Server::Registry).as_null_object }
9
+ let(:stub_registry) { instance_double(HttpStub::Server::Stub::Registry).as_null_object }
10
+ let(:match_registry) { instance_double(HttpStub::Server::Registry).as_null_object }
11
+ let(:miss_registry) { instance_double(HttpStub::Server::Registry).as_null_object }
12
12
 
13
- let(:controller) { HttpStub::Server::Stub::Controller.new(stub_registry, match_result_registry) }
13
+ let(:controller) { HttpStub::Server::Stub::Controller.new(stub_registry, match_registry, miss_registry) }
14
14
 
15
15
  before(:example) do
16
16
  allow(HttpStub::Server::Stub::Parser).to receive(:parse).and_return(payload)
@@ -39,15 +39,15 @@ describe HttpStub::Server::Stub::Controller do
39
39
  subject
40
40
  end
41
41
 
42
- it "creates a success response with a location header containing the stubs uri" do
43
- expect(HttpStub::Server::Response).to receive(:success).with("location" => stub_uri)
42
+ it "creates an ok response with a location header containing the stubs uri" do
43
+ expect(HttpStub::Server::Response).to receive(:ok).with("headers" => { "location" => stub_uri })
44
44
 
45
45
  subject
46
46
  end
47
47
 
48
- it "returns the success response" do
48
+ it "returns the ok response" do
49
49
  response = double("HttpStub::Server::Response")
50
- allow(HttpStub::Server::Response).to receive(:success).and_return(response)
50
+ allow(HttpStub::Server::Response).to receive(:ok).and_return(response)
51
51
 
52
52
  expect(subject).to eql(response)
53
53
  end
@@ -63,29 +63,36 @@ describe HttpStub::Server::Stub::Controller do
63
63
  before(:example) do
64
64
  allow(stub_registry).to receive(:match).with(request, logger).and_return(matched_stub)
65
65
  allow(the_stub).to receive(:response_for).and_return(calculated_stub_response)
66
- allow(match_result_registry).to receive(:add)
67
66
  end
68
67
 
69
68
  describe "when a stub has been registered that matches the request" do
70
69
 
71
70
  let(:matched_stub) { the_stub }
72
71
 
72
+ before(:example) { allow(match_registry).to receive(:add) }
73
+
73
74
  it "calculates the stubs response based on the request" do
74
75
  expect(the_stub).to receive(:response_for).with(request)
75
76
 
76
77
  subject
77
78
  end
78
79
 
79
- it "determines the match result for the request, calculated response and stub" do
80
- expect(HttpStub::Server::Stub::Match::Result).to receive(:new).with(request, calculated_stub_response, the_stub)
80
+ it "creates a match for the request, calculated response and stub" do
81
+ expect(HttpStub::Server::Stub::Match::Match).to receive(:new).with(request, calculated_stub_response, the_stub)
81
82
 
82
83
  subject
83
84
  end
84
85
 
85
- it "adds the match result to the match result registry" do
86
- expect(match_result_registry).to(
87
- receive(:add).with(an_instance_of(HttpStub::Server::Stub::Match::Result), logger)
88
- )
86
+ it "adds the match to the match registry" do
87
+ match = instance_double(HttpStub::Server::Stub::Match::Match)
88
+ allow(HttpStub::Server::Stub::Match::Match).to receive(:new).and_return(match)
89
+ expect(match_registry).to receive(:add).with(match, logger)
90
+
91
+ subject
92
+ end
93
+
94
+ it "does not add to the miss registry" do
95
+ expect(miss_registry).to_not receive(:add)
89
96
 
90
97
  subject
91
98
  end
@@ -100,22 +107,28 @@ describe HttpStub::Server::Stub::Controller do
100
107
 
101
108
  let(:matched_stub) { nil }
102
109
 
110
+ before(:example) { allow(miss_registry).to receive(:add) }
111
+
103
112
  it "returns a not found response" do
104
113
  expect(subject).to eql(HttpStub::Server::Response::NOT_FOUND)
105
114
  end
106
115
 
107
- it "creates a match result for request with the not found response and no stub" do
108
- expect(HttpStub::Server::Stub::Match::Result).to(
109
- receive(:new).with(request, HttpStub::Server::Response::NOT_FOUND, nil)
110
- )
116
+ it "creates a miss for the request" do
117
+ expect(HttpStub::Server::Stub::Match::Miss).to receive(:new).with(request)
118
+
119
+ subject
120
+ end
121
+
122
+ it "adds the miss to the miss registry" do
123
+ miss = instance_double(HttpStub::Server::Stub::Match::Miss)
124
+ allow(HttpStub::Server::Stub::Match::Miss).to receive(:new).and_return(miss)
125
+ expect(miss_registry).to receive(:add).with(miss, logger)
111
126
 
112
127
  subject
113
128
  end
114
129
 
115
- it "adds the match result to the match result registry" do
116
- expect(match_result_registry).to(
117
- receive(:add).with(an_instance_of(HttpStub::Server::Stub::Match::Result), logger)
118
- )
130
+ it "does not add to the match registry" do
131
+ expect(match_registry).to_not receive(:add)
119
132
 
120
133
  subject
121
134
  end
@@ -134,8 +147,14 @@ describe HttpStub::Server::Stub::Controller do
134
147
  subject
135
148
  end
136
149
 
137
- it "clears the match result registry" do
138
- expect(match_result_registry).to receive(:clear).with(logger)
150
+ it "clears the match registry" do
151
+ expect(match_registry).to receive(:clear).with(logger)
152
+
153
+ subject
154
+ end
155
+
156
+ it "clears the miss registry" do
157
+ expect(miss_registry).to receive(:clear).with(logger)
139
158
 
140
159
  subject
141
160
  end
@@ -2,26 +2,18 @@ describe HttpStub::Server::Stub::Empty do
2
2
 
3
3
  let(:empty_stub) { HttpStub::Server::Stub::Empty::INSTANCE }
4
4
 
5
- %w{ uri method stub_uri body }.each do |empty_string_attribute|
6
-
7
- describe "##{empty_string_attribute}" do
8
-
9
- it "is an empty string" do
10
- expect(empty_stub.send(empty_string_attribute.to_sym)).to eql("")
11
- end
5
+ describe "#uri" do
12
6
 
7
+ it "is an empty string" do
8
+ expect(empty_stub.uri).to eql("")
13
9
  end
14
10
 
15
11
  end
16
12
 
17
- %w{ headers parameters }.each do |empty_hash_attribute|
18
-
19
- describe "##{empty_hash_attribute}" do
20
-
21
- it "is an empty hash" do
22
- expect(empty_stub.send(empty_hash_attribute.to_sym)).to eql({})
23
- end
13
+ describe "#match_rules" do
24
14
 
15
+ it "is empty" do
16
+ expect(empty_stub.match_rules).to eql(HttpStub::Server::Stub::Match::Rules::EMPTY)
25
17
  end
26
18
 
27
19
  end
@@ -63,6 +55,14 @@ describe HttpStub::Server::Stub::Empty do
63
55
 
64
56
  end
65
57
 
58
+ describe "#to_hash" do
59
+
60
+ it "returns an empty hash" do
61
+ expect(empty_stub.to_hash).to eql({})
62
+ end
63
+
64
+ end
65
+
66
66
  describe "#to_s" do
67
67
 
68
68
  it "returns an empty string" do
@@ -0,0 +1,69 @@
1
+ describe HttpStub::Server::Stub::Match::Controller do
2
+
3
+ let(:registry) { instance_double(HttpStub::Server::Registry) }
4
+
5
+ let(:controller) { described_class.new(registry) }
6
+
7
+ describe "#find_last" do
8
+
9
+ let(:uri) { "/some/endpoint/uri" }
10
+ let(:method) { "PATCH" }
11
+ let(:parameters) { { uri: uri, method: method } }
12
+ let(:request) { instance_double(HttpStub::Server::Request::Request, parameters: parameters) }
13
+ let(:logger) { instance_double(Logger) }
14
+
15
+ subject { controller.find_last(request, logger) }
16
+
17
+ it "finds the match in the registry with the uri requested" do
18
+ expect(registry).to receive(:find).with(hash_including(uri: uri), anything)
19
+
20
+ subject
21
+ end
22
+
23
+ it "finds the match in the registry with the HTTP method requested" do
24
+ expect(registry).to receive(:find).with(hash_including(method: method), anything)
25
+
26
+ subject
27
+ end
28
+
29
+ it "finds the match using the provided logger for diagnostics" do
30
+ expect(registry).to receive(:find).with(anything, logger)
31
+
32
+ subject
33
+ end
34
+
35
+ context "when a match is found" do
36
+
37
+ let(:match_json) { "some match JSON" }
38
+ let(:match) { instance_double(HttpStub::Server::Stub::Match::Match, to_json: match_json) }
39
+
40
+ before(:example) { allow(registry).to receive(:find).and_return(match) }
41
+
42
+ it "creates an ok response containing the JSON representation of the match" do
43
+ expect(HttpStub::Server::Response).to receive(:ok).with("body" => match_json)
44
+
45
+ subject
46
+ end
47
+
48
+ it "returns the response" do
49
+ response = instance_double(HttpStub::Server::Stub::Response::Text)
50
+ allow(HttpStub::Server::Response).to receive(:ok).and_return(response)
51
+
52
+ expect(subject).to eql(response)
53
+ end
54
+
55
+ end
56
+
57
+ context "when a match is not found" do
58
+
59
+ before(:example) { allow(registry).to receive(:find).and_return(nil) }
60
+
61
+ it "returns a not found response" do
62
+ expect(subject).to eql(HttpStub::Server::Response::NOT_FOUND)
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
69
+ end