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
@@ -4,7 +4,7 @@ module HttpStub
4
4
 
5
5
  class Triggers
6
6
 
7
- delegate :each, to: :@triggers
7
+ delegate :each, :as_json, to: :@triggers
8
8
 
9
9
  def initialize(triggers)
10
10
  @triggers = (triggers || []).map { |trigger| HttpStub::Server::Stub.create(trigger) }
@@ -1,10 +1,23 @@
1
- %form{ id: :activate_scenario_form, action: "scenarios/activate", method: "POST" }
2
- %input{ id: :activated_scenario_name, name: :name, type: :hidden, value: "" }
3
1
  :javascript
4
2
  $(window).load(function() {
5
3
  $("a.activate_scenario").on("click", function(event) {
6
4
  event.preventDefault();
7
- $("#activated_scenario_name").val($(event.target).data("name"));
8
- $("#activate_scenario_form").submit();
5
+ var button = $(event.target)
6
+ button.prop("disabled", true);
7
+ $.post(
8
+ "scenarios/activate", { name: button.data("name") }, null, "html"
9
+ ).done(
10
+ function() {
11
+ button.html("Activated").css("color", "green");
12
+ setTimeout(function() { button.html("Activate").css("color", "inherit"); }, 3000);
13
+ }
14
+ ).fail(
15
+ function() {
16
+ button.html("Failed").css("color", "red");
17
+ setTimeout(function() { button.html("Activate").css("color", "inherit"); }, 3000);
18
+ }
19
+ ).always(
20
+ function() { button.prop("disabled", false); }
21
+ );
9
22
  });
10
23
  });
@@ -1,6 +1,6 @@
1
1
  %article
2
- %h3 Request
3
- = partial :request, locals: { request: the_stub }
2
+ %h3 Match Rules
3
+ = partial :request, locals: { request: the_stub.match_rules }
4
4
  %h3 Response
5
5
  = partial :response, locals: { response: the_stub.response }
6
6
  %h3 Triggers
@@ -4,4 +4,4 @@
4
4
  %h3 Response
5
5
  = partial :response, locals: { response: match.response }
6
6
  %h3 Matched Stub
7
- %a{ href: match.stub.stub_uri, class: [:stub, :link] } Match
7
+ %a{ href: match.stub.uri, class: [:stub, :link] } Match
@@ -0,0 +1,3 @@
1
+ %article
2
+ %h3 Request
3
+ = partial :request, locals: { request: miss.request }
@@ -1,6 +1,8 @@
1
1
  %h1 http_stub diagnostics
2
+ %a{ href: "/http_stub/scenarios", id: :scenarios, class: :link } List Scenarios
3
+ %br
2
4
  %a{ href: "/http_stub/stubs", id: :stubs, class: :link } List Stubs
3
5
  %br
4
- %a{ href: "/http_stub/scenarios", id: :scenarios, class: :link } List Scenarios
6
+ %a{ href: "/http_stub/stubs/matches", id: :stub_matches, class: :link } List Stub Matches
5
7
  %br
6
- %a{ href: "/http_stub/stubs/matches", id: :stub_matches, class: :link } List Stub Matches & Misses
8
+ %a{ href: "/http_stub/stubs/misses", id: :stub_misses, class: :link } List Stub Misses
@@ -0,0 +1,4 @@
1
+ %h1 Stub Matches
2
+ - matches.each do |match|
3
+ = partial :stub_match, locals: { match: match }
4
+ %br
@@ -0,0 +1,4 @@
1
+ %h1 Stub Misses
2
+ - misses.each do |miss|
3
+ = partial :stub_miss, locals: { miss: miss }
4
+ %br
@@ -1,3 +1,3 @@
1
1
  module HttpStub
2
- VERSION = "0.24.3".freeze
2
+ VERSION = "0.25.0".freeze
3
3
  end
@@ -0,0 +1,170 @@
1
+ describe "Stub matches last acceptance" do
2
+ include_context "configurer integration"
3
+
4
+ before(:example) { configurer.initialize! }
5
+
6
+ after(:example) { configurer.clear_stubs! }
7
+
8
+ describe "GET /http_stub/stubs/matches/last" do
9
+
10
+ let(:request_uri) { stub_registrator.request_uri }
11
+ let(:request_method) { stub_registrator.request_method }
12
+ let(:request_parameters) { { uri: request_uri, method: request_method } }
13
+ let(:response) { HTTParty.get("#{server_uri}/http_stub/stubs/matches/last", query: request_parameters) }
14
+ let(:json_response) { JSON.parse(response.body) }
15
+
16
+ before(:example) { configure_stub_registrator }
17
+
18
+ context "when a request has been made matching a stub" do
19
+
20
+ before(:example) do
21
+ stub_registrator.register_stub
22
+
23
+ stub_registrator.issue_matching_request
24
+ end
25
+
26
+ it "returns a 200 response" do
27
+ expect(response.code).to eql(200)
28
+ end
29
+
30
+ it "returns JSON containing the requests uri" do
31
+ expect_match_request_to_include("uri" => request_uri)
32
+ end
33
+
34
+ it "returns JSON containing the requests method" do
35
+ expect_match_request_to_include("method" => request_method)
36
+ end
37
+
38
+ it "returns JSON containing the requests headers whose names are in uppercase" do
39
+ stub_registrator.request_headers.each do |header_key, expected_header_value|
40
+ expect_match_request_to_include("headers" => hash_including(header_key.upcase => expected_header_value))
41
+ end
42
+ end
43
+
44
+ context "when the request contains parameters" do
45
+
46
+ def configure_stub_registrator
47
+ stub_registrator.with_request_parameters
48
+ end
49
+
50
+ it "returns JSON containing the requests parameters" do
51
+ stub_registrator.request_parameters.each do |expected_parameter_key, expected_parameter_value|
52
+ expect_match_request_to_include(
53
+ "parameters" => hash_including(expected_parameter_key => expected_parameter_value)
54
+ )
55
+ end
56
+ end
57
+
58
+ end
59
+
60
+ context "when the request contains a body" do
61
+
62
+ def configure_stub_registrator
63
+ stub_registrator.with_request_body
64
+ end
65
+
66
+ it "returns JSON containing the requests body" do
67
+ expect_match_request_to_include("body" => stub_registrator.request_body)
68
+ end
69
+
70
+ end
71
+
72
+ it "returns JSON containing the matches response status" do
73
+ expect_match_response_to_include("status" => stub_registrator.stub_response_status)
74
+ end
75
+
76
+ it "returns JSON containing the matches response headers" do
77
+ stub_registrator.stub_response_headers.each do |expected_header_key, expected_header_value|
78
+ expect_match_response_to_include("headers" => hash_including(expected_header_key => expected_header_value))
79
+ end
80
+ end
81
+
82
+ it "returns JSON containing the matches response body" do
83
+ expect_match_response_to_include("body" => stub_registrator.stub_response_body)
84
+ end
85
+
86
+ it "returns JSON containing the uri of the matched stub" do
87
+ expect(json_response).to include("stub" => hash_including("uri" => stub_registrator.stub_uri))
88
+ end
89
+
90
+ end
91
+
92
+ context "when a request has been made matching a stub whose response includes request references" do
93
+
94
+ before(:example) do
95
+ stub_registrator.with_request_parameters
96
+ stub_registrator.with_request_interpolation
97
+
98
+ stub_registrator.register_stub
99
+
100
+ stub_registrator.issue_matching_request
101
+ end
102
+
103
+ it "returns a 200 response" do
104
+ expect(response.code).to eql(200)
105
+ end
106
+
107
+ it "returns JSON containing the matches response headers with interpolated request references" do
108
+ expected_stub_response_headers = {
109
+ "header_reference" => "request header value 2",
110
+ "parameter_reference" => "parameter value 2"
111
+ }
112
+
113
+ expected_stub_response_headers.each do |expected_header_key, expected_header_value|
114
+ expect_match_response_to_include("headers" => hash_including(expected_header_key => expected_header_value))
115
+ end
116
+ end
117
+
118
+ it "returns JSON containing the matches response body with interpolated request references" do
119
+ expected_stub_response_body = "header: request header value 3, parameter: parameter value 3"
120
+
121
+ expect_match_response_to_include("body" => expected_stub_response_body)
122
+ end
123
+
124
+ end
125
+
126
+ context "when a request has been made that does not match a stub" do
127
+
128
+ before(:example) { stub_registrator.issue_matching_request }
129
+
130
+ it "returns a 404 response" do
131
+ expect(response.code).to eql(404)
132
+ end
133
+
134
+ end
135
+
136
+ context "when a request has been made configuring a stub" do
137
+
138
+ before(:example) { stub_registrator.register_stub }
139
+
140
+ it "returns a 404 response" do
141
+ expect(response.code).to eql(404)
142
+ end
143
+
144
+ end
145
+
146
+ context "when a request has been made configuring a scenario" do
147
+
148
+ before(:example) { stub_registrator.register_scenario }
149
+
150
+ it "returns a 404 response" do
151
+ expect(response.code).to eql(404)
152
+ end
153
+
154
+ end
155
+
156
+ def configure_stub_registrator
157
+ # intentionally blank
158
+ end
159
+
160
+ def expect_match_request_to_include(hash)
161
+ expect(json_response).to(include("request" => hash_including(hash)))
162
+ end
163
+
164
+ def expect_match_response_to_include(hash)
165
+ expect(json_response).to(include("response" => hash_including(hash)))
166
+ end
167
+
168
+ end
169
+
170
+ end
@@ -0,0 +1,115 @@
1
+ describe "Stub match list acceptance" do
2
+ include_context "configurer integration"
3
+
4
+ before(:example) { configurer.initialize! }
5
+
6
+ after(:example) { configurer.clear_stubs! }
7
+
8
+ describe "GET /http_stub/stubs/matches" do
9
+
10
+ let(:response) { HTTParty.get("#{server_uri}/http_stub/stubs/matches") }
11
+ let(:response_document) { Nokogiri::HTML(response.body) }
12
+
13
+ before(:example) { configure_stub_registrator }
14
+
15
+ context "when a request has been made matching a stub" do
16
+
17
+ before(:example) do
18
+ stub_registrator.register_stub
19
+
20
+ stub_registrator.issue_matching_request
21
+ end
22
+
23
+ include_context "HTML view including request details"
24
+
25
+ it "returns a response body that contains stub response status" do
26
+ expect(response.body).to match(/#{escape_html(stub_registrator.stub_response_status)}/)
27
+ end
28
+
29
+ it "returns a response body that contains stub response headers" do
30
+ stub_registrator.stub_response_headers.each do |expected_header_key, expected_header_value|
31
+ expect(response.body).to match(/#{expected_header_key}:#{expected_header_value}/)
32
+ end
33
+ end
34
+
35
+ it "returns a response body that contains stub response body" do
36
+ expect(response.body).to match(/#{escape_html(stub_registrator.stub_response_body)}/)
37
+ end
38
+
39
+ it "returns a response body that contains a link to the matched stub" do
40
+ stub_link = response_document.css("a.stub").first
41
+ expect(stub_registrator.stub_uri).to end_with(stub_link["href"])
42
+ end
43
+
44
+ end
45
+
46
+ context "when a request has been made matching a stub whose response includes request references" do
47
+
48
+ before(:example) do
49
+ stub_registrator.with_request_parameters
50
+ stub_registrator.with_request_interpolation
51
+
52
+ stub_registrator.register_stub
53
+
54
+ stub_registrator.issue_matching_request
55
+ end
56
+
57
+ it "returns a response body that contains stub response status" do
58
+ expect(response.body).to match(/#{stub_registrator.stub_response_status}/)
59
+ end
60
+
61
+ it "returns a response body that contains stub response headers with interpolated request references" do
62
+ expected_stub_response_headers = {
63
+ header_reference: "request header value 2",
64
+ parameter_reference: "parameter value 2"
65
+ }
66
+
67
+ expected_stub_response_headers.each do |expected_header_key, expected_header_value|
68
+ expect(response.body).to match(/#{expected_header_key}:#{expected_header_value}/)
69
+ end
70
+ end
71
+
72
+ it "returns a response body that contains stub response body with interpolated request references" do
73
+ expected_stub_response_body = "header: request header value 3, parameter: parameter value 3"
74
+
75
+ expect(response.body).to match(/#{escape_html(expected_stub_response_body)}/)
76
+ end
77
+
78
+ it "returns a response body that contains a link to the matched stub" do
79
+ stub_link = response_document.css("a.stub").first
80
+ expect(stub_registrator.stub_uri).to end_with(stub_link["href"])
81
+ end
82
+
83
+ end
84
+
85
+ context "when a request has been made that does not match a stub" do
86
+
87
+ before(:example) { stub_registrator.issue_matching_request }
88
+
89
+ include_context "HTML view excluding request details"
90
+
91
+ end
92
+
93
+ context "when a request has been made configuring a stub" do
94
+
95
+ before(:example) { stub_registrator.register_stub }
96
+
97
+ include_context "HTML view excluding request details"
98
+
99
+ end
100
+
101
+ context "when a request has been made configuring a scenario" do
102
+
103
+ before(:example) { stub_registrator.register_scenario }
104
+
105
+ include_context "HTML view excluding request details"
106
+
107
+ end
108
+
109
+ def configure_stub_registrator
110
+ # intentionally blank
111
+ end
112
+
113
+ end
114
+
115
+ end
@@ -0,0 +1,58 @@
1
+ describe "Stub miss list acceptance" do
2
+ include_context "configurer integration"
3
+
4
+ before(:example) { configurer.initialize! }
5
+
6
+ after(:example) { configurer.clear_stubs! }
7
+
8
+ describe "GET /http_stub/stubs/misses" do
9
+
10
+ let(:response) { HTTParty.get("#{server_uri}/http_stub/stubs/misses") }
11
+ let(:response_document) { Nokogiri::HTML(response.body) }
12
+
13
+ before(:example) { configure_stub_registrator }
14
+
15
+ context "when a request has been made that does not match a stub" do
16
+
17
+ before(:example) { stub_registrator.issue_matching_request }
18
+
19
+ include_context "HTML view including request details"
20
+
21
+ end
22
+
23
+ context "when a request has been made matching a stub" do
24
+
25
+ before(:example) do
26
+ stub_registrator.register_stub
27
+
28
+ stub_registrator.issue_matching_request
29
+ end
30
+
31
+ include_context "HTML view excluding request details"
32
+
33
+ end
34
+
35
+ context "when a request has been made configuring a stub" do
36
+
37
+ before(:example) { stub_registrator.register_stub }
38
+
39
+
40
+ include_context "HTML view excluding request details"
41
+
42
+ end
43
+
44
+ context "when a request has been made configuring a scenario" do
45
+
46
+ before(:example) { stub_registrator.register_scenario }
47
+
48
+ include_context "HTML view excluding request details"
49
+
50
+ end
51
+
52
+ def configure_stub_registrator
53
+ # intentionally blank
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -4,23 +4,27 @@ describe HttpStub::Server::Application::Application do
4
4
  let(:response) { last_response }
5
5
  let(:response_body) { response.body.to_s }
6
6
 
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) }
7
+ let(:scenario_registry) { instance_double(HttpStub::Server::Registry) }
8
+ let(:stub_registry) { instance_double(HttpStub::Server::Stub::Registry) }
9
+ let(:stub_match_registry) { instance_double(HttpStub::Server::Registry) }
10
+ let(:stub_miss_registry) { instance_double(HttpStub::Server::Registry) }
10
11
 
11
- let(:stub_controller) { instance_double(HttpStub::Server::Stub::Controller) }
12
- let(:scenario_controller) { instance_double(HttpStub::Server::Scenario::Controller) }
12
+ let(:scenario_controller) { instance_double(HttpStub::Server::Scenario::Controller) }
13
+ let(:stub_controller) { instance_double(HttpStub::Server::Stub::Controller) }
14
+ let(:stub_match_controller) { instance_double(HttpStub::Server::Stub::Match::Controller) }
13
15
 
14
16
  let(:response_pipeline) { instance_double(HttpStub::Server::Application::ResponsePipeline, process: nil) }
15
17
 
16
18
  let(:app) { HttpStub::Server::Application::Application.new! }
17
19
 
18
20
  before(:example) do
19
- allow(HttpStub::Server::Registry).to receive(:new).with("match result").and_return(match_result_registry)
20
21
  allow(HttpStub::Server::Registry).to receive(:new).with("scenario").and_return(scenario_registry)
21
22
  allow(HttpStub::Server::Stub::Registry).to receive(:new).and_return(stub_registry)
22
- allow(HttpStub::Server::Stub::Controller).to receive(:new).and_return(stub_controller)
23
+ allow(HttpStub::Server::Registry).to receive(:new).with("stub match").and_return(stub_match_registry)
24
+ allow(HttpStub::Server::Registry).to receive(:new).with("stub miss").and_return(stub_miss_registry)
23
25
  allow(HttpStub::Server::Scenario::Controller).to receive(:new).and_return(scenario_controller)
26
+ allow(HttpStub::Server::Stub::Controller).to receive(:new).and_return(stub_controller)
27
+ allow(HttpStub::Server::Stub::Match::Controller).to receive(:new).and_return(stub_match_controller)
24
28
  allow(HttpStub::Server::Application::ResponsePipeline).to receive(:new).and_return(response_pipeline)
25
29
  end
26
30
 
@@ -149,14 +153,54 @@ describe HttpStub::Server::Application::Application do
149
153
 
150
154
  end
151
155
 
152
- context "when a request to list the matches is received" do
156
+ context "when a request to list the stub matches is received" do
153
157
 
154
- let(:found_match_results) { [ HttpStub::Server::Stub::Match::ResultFixture.empty ] }
158
+ let(:found_matches) { [ HttpStub::Server::Stub::Match::MatchFixture.create ] }
155
159
 
156
160
  subject { get "/http_stub/stubs/matches" }
157
161
 
158
- it "retrieves the match results from the registry" do
159
- expect(match_result_registry).to receive(:all).and_return(found_match_results)
162
+ it "retrieves the matches from the match registry" do
163
+ expect(stub_match_registry).to receive(:all).and_return(found_matches)
164
+
165
+ subject
166
+ end
167
+
168
+ end
169
+
170
+ context "when a request to retrieve the last match for an endpoint is received" do
171
+
172
+ let(:uri) { "/some/matched/uri" }
173
+ let(:method) { "some http method" }
174
+ let(:last_match_response) { instance_double(HttpStub::Server::Stub::Response::Base) }
175
+
176
+ subject { get "/http_stub/stubs/matches/last", "uri" => uri, "method" => method }
177
+
178
+ before(:example) { allow(stub_match_controller).to receive(:find_last).and_return(last_match_response) }
179
+
180
+ it "retrieves the last match from the match result registry for the provided request" do
181
+ expect(stub_match_controller).to(
182
+ receive(:find_last).with(an_instance_of(HttpStub::Server::Request::Request), anything)
183
+ )
184
+
185
+ subject
186
+ end
187
+
188
+ it "processes the match result controllers response via the response pipeline" do
189
+ expect(response_pipeline).to receive(:process).with(last_match_response)
190
+
191
+ subject
192
+ end
193
+
194
+ end
195
+
196
+ context "when a request to list the stub misses is received" do
197
+
198
+ let(:found_misses) { [ HttpStub::Server::Stub::Match::MissFixture.create ] }
199
+
200
+ subject { get "/http_stub/stubs/misses" }
201
+
202
+ it "retrieves the misses from the miss registry" do
203
+ expect(stub_miss_registry).to receive(:all).and_return(found_misses)
160
204
 
161
205
  subject
162
206
  end
@@ -195,7 +239,7 @@ describe HttpStub::Server::Application::Application do
195
239
  context "when a request to show a scenario is received" do
196
240
 
197
241
  let(:scenario_name) { "Some scenario name" }
198
- let(:found_scenario) { HttpStub::Server::Scenario::ScenarioFixture.empty }
242
+ let(:found_scenario) { HttpStub::Server::Scenario::ScenarioFixture.create }
199
243
 
200
244
  subject { get "/http_stub/scenarios?#{URI.encode_www_form(:name => scenario_name)}" }
201
245
 
@@ -209,7 +253,7 @@ describe HttpStub::Server::Application::Application do
209
253
 
210
254
  context "when a request to list the scenarios is received" do
211
255
 
212
- let(:found_scenarios) { [ HttpStub::Server::Scenario::ScenarioFixture.empty ] }
256
+ let(:found_scenarios) { [ HttpStub::Server::Scenario::ScenarioFixture.create ] }
213
257
 
214
258
  subject { get "/http_stub/scenarios" }
215
259