pact 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/CHANGELOG.md +20 -0
  2. data/Gemfile.lock +3 -3
  3. data/example/animal-service/Gemfile +14 -0
  4. data/example/animal-service/Gemfile.lock +67 -0
  5. data/example/animal-service/Rakefile +3 -0
  6. data/example/animal-service/spec/service_consumers/pact_helper.rb +24 -0
  7. data/example/animal-service/spec/service_consumers/provider_states_for_zoo_app.rb +9 -0
  8. data/example/zoo-app/Gemfile.lock +2 -15
  9. data/example/zoo-app/spec/pacts/zoo_app-animal_service.json +21 -6
  10. data/example/zoo-app/spec/service_providers/animal_service_spec.rb +1 -1
  11. data/lib/pact/consumer.rb +10 -11
  12. data/lib/pact/consumer/app_manager.rb +1 -0
  13. data/lib/pact/consumer/configuration.rb +179 -0
  14. data/lib/pact/consumer/interaction_builder.rb +1 -2
  15. data/lib/pact/consumer/mock_service.rb +1 -370
  16. data/lib/pact/consumer/mock_service/app.rb +70 -0
  17. data/lib/pact/consumer/mock_service/interaction_delete.rb +28 -0
  18. data/lib/pact/consumer/mock_service/interaction_list.rb +57 -0
  19. data/lib/pact/consumer/mock_service/interaction_post.rb +25 -0
  20. data/lib/pact/consumer/mock_service/interaction_replay.rb +126 -0
  21. data/lib/pact/consumer/mock_service/missing_interactions_get.rb +26 -0
  22. data/lib/pact/consumer/mock_service/rack_request_helper.rb +51 -0
  23. data/lib/pact/consumer/mock_service/startup_poll.rb +22 -0
  24. data/lib/pact/consumer/mock_service/verification_get.rb +35 -0
  25. data/lib/pact/consumer/mock_service_client.rb +3 -1
  26. data/lib/pact/consumer/mock_service_interaction_expectation.rb +33 -0
  27. data/lib/pact/consumer/request.rb +27 -0
  28. data/lib/pact/consumer/rspec.rb +1 -4
  29. data/lib/pact/consumer_contract/consumer_contract.rb +11 -8
  30. data/lib/pact/consumer_contract/interaction.rb +9 -22
  31. data/lib/pact/consumer_contract/request.rb +68 -0
  32. data/lib/pact/consumer_contract/service_consumer.rb +6 -2
  33. data/lib/pact/consumer_contract/service_provider.rb +6 -2
  34. data/lib/pact/matchers/index_not_found.rb +20 -0
  35. data/lib/pact/matchers/matchers.rb +14 -28
  36. data/lib/pact/matchers/unexpected_index.rb +17 -0
  37. data/lib/pact/matchers/unexpected_key.rb +17 -0
  38. data/lib/pact/provider.rb +1 -1
  39. data/lib/pact/provider/configuration.rb +129 -0
  40. data/lib/pact/provider/request.rb +59 -0
  41. data/lib/pact/provider/rspec.rb +4 -5
  42. data/lib/pact/provider/test_methods.rb +14 -52
  43. data/lib/pact/shared/dsl.rb +20 -0
  44. data/lib/pact/shared/key_not_found.rb +24 -0
  45. data/lib/pact/shared/null_expectation.rb +31 -0
  46. data/lib/pact/shared/request.rb +68 -0
  47. data/lib/pact/something_like.rb +7 -1
  48. data/lib/pact/symbolize_keys.rb +12 -0
  49. data/lib/pact/tasks.rb +1 -1
  50. data/lib/pact/tasks/task_helper.rb +23 -0
  51. data/lib/pact/{verification_task.rb → tasks/verification_task.rb} +4 -4
  52. data/lib/pact/version.rb +1 -1
  53. data/lib/tasks/pact.rake +5 -4
  54. data/pact.gemspec +1 -1
  55. data/spec/features/consumption_spec.rb +1 -73
  56. data/spec/features/production_spec.rb +3 -0
  57. data/spec/integration/consumer_spec.rb +170 -0
  58. data/spec/integration/pact/consumer_configuration_spec.rb +1 -1
  59. data/spec/lib/pact/consumer/{dsl_spec.rb → configuration_spec.rb} +10 -9
  60. data/spec/lib/pact/consumer/consumer_contract_builder_spec.rb +2 -2
  61. data/spec/lib/pact/consumer/interaction_builder_spec.rb +1 -1
  62. data/spec/lib/pact/consumer/mock_service/interaction_list_spec.rb +66 -0
  63. data/spec/lib/pact/consumer/mock_service/rack_request_helper_spec.rb +82 -0
  64. data/spec/lib/pact/consumer/mock_service_interaction_expectation_spec.rb +54 -0
  65. data/spec/lib/pact/consumer/request_spec.rb +24 -0
  66. data/spec/lib/pact/consumer_contract/consumer_contract_spec.rb +1 -1
  67. data/spec/lib/pact/consumer_contract/interaction_spec.rb +0 -34
  68. data/spec/lib/pact/{request_spec.rb → consumer_contract/request_spec.rb} +45 -121
  69. data/spec/lib/pact/matchers/matchers_spec.rb +29 -13
  70. data/spec/lib/pact/provider/configuration_spec.rb +163 -0
  71. data/spec/lib/pact/provider/request_spec.rb +78 -0
  72. data/spec/lib/pact/provider/test_methods_spec.rb +0 -30
  73. data/spec/lib/pact/verification_task_spec.rb +1 -1
  74. data/spec/spec_helper.rb +3 -0
  75. data/spec/support/factories.rb +5 -1
  76. data/spec/support/pact_helper.rb +6 -0
  77. data/spec/support/shared_examples_for_request.rb +83 -0
  78. data/spec/support/test_app_fail.json +3 -0
  79. data/spec/support/test_app_pass.json +18 -1
  80. metadata +68 -31
  81. data/lib/pact/consumer/dsl.rb +0 -157
  82. data/lib/pact/pact_task_helper.rb +0 -21
  83. data/lib/pact/provider/dsl.rb +0 -115
  84. data/lib/pact/request.rb +0 -167
  85. data/spec/lib/pact/consumer/mock_service_spec.rb +0 -143
  86. data/spec/lib/pact/provider/dsl_spec.rb +0 -179
@@ -0,0 +1,82 @@
1
+ require 'spec_helper'
2
+ require 'pact/consumer/mock_service/rack_request_helper'
3
+
4
+ module Pact::Consumer
5
+
6
+ describe RackRequestHelper do
7
+ class TestSubject
8
+ include RackRequestHelper
9
+ end
10
+
11
+ let(:rack_env) {
12
+ {
13
+ "CONTENT_LENGTH" => "16",
14
+ "CONTENT_TYPE" => content_type,
15
+ "GATEWAY_INTERFACE" => "CGI/1.1",
16
+ "PATH_INFO" => "/donuts",
17
+ "QUERY_STRING" => "",
18
+ "REMOTE_ADDR" => "127.0.0.1",
19
+ "REMOTE_HOST" => "localhost",
20
+ "REQUEST_METHOD" => "POST",
21
+ "REQUEST_URI" => "http://localhost:4321/donuts",
22
+ "SCRIPT_NAME" => "",
23
+ "SERVER_NAME" => "localhost",
24
+ "SERVER_PORT" => "4321",
25
+ "SERVER_PROTOCOL" => "HTTP/1.1",
26
+ "SERVER_SOFTWARE" => "WEBrick/1.3.1 (Ruby/1.9.3/2013-02-22)",
27
+ "HTTP_ACCEPT" => "text/plain",
28
+ "HTTP_USER_AGENT" => "Ruby",
29
+ "HTTP_HOST" => "localhost:4321",
30
+ "rack.version" => [1, 2 ],
31
+ "rack.input" => StringIO.new(body),
32
+ "rack.errors" => nil,
33
+ "rack.multithread" => true,
34
+ "rack.multiprocess" => false,
35
+ "rack.run_once" => false,
36
+ "rack.url_scheme" => "http",
37
+ "HTTP_VERSION" => "HTTP/1.1",
38
+ "REQUEST_PATH" => "/donuts"
39
+ }
40
+ }
41
+
42
+ subject { TestSubject.new }
43
+
44
+ let(:expected_request) {
45
+ {
46
+ :query => "",
47
+ :method => "post",
48
+ :body => expected_body,
49
+ :path => "/donuts",
50
+ :headers => {
51
+ "Content-Type" => content_type,
52
+ "Accept" => "text/plain",
53
+ "User-Agent" => "Ruby",
54
+ "Host" => "localhost:4321",
55
+ "Version" => "HTTP/1.1"
56
+ }
57
+ }
58
+ }
59
+
60
+ context "with a text body" do
61
+ let(:content_type) { "application/x-www-form-urlencoded" }
62
+ let(:body) { 'this is the body' }
63
+ let(:expected_body) { body }
64
+
65
+ it "extracts the body" do
66
+ expect(subject.request_as_hash_from(rack_env)).to eq expected_request
67
+ end
68
+ end
69
+
70
+ context "with a json body" do
71
+ let(:content_type) { "application/json" }
72
+ let(:body) { '{"a" : "body" }' }
73
+ let(:expected_body) { {"a" => "body"} }
74
+
75
+ it "extracts the body" do
76
+ expect(subject.request_as_hash_from(rack_env)).to eq expected_request
77
+ end
78
+ end
79
+
80
+
81
+ end
82
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+ require 'pact/consumer/mock_service_interaction_expectation'
3
+
4
+ describe Pact::Consumer::MockServiceInteractionExpectation do
5
+ describe "as_json" do
6
+ let(:options ) { {} }
7
+ let(:request_as_json) { {a: 'request'} }
8
+ let(:request) { instance_double('Pact::Request::Expected', :as_json => request_as_json, :options => options)}
9
+ let(:response) { double('response') }
10
+ let(:generated_response ) { double('generated_response', :to_json => 'generated_response') }
11
+ let(:interaction) { instance_double('Pact::Interaction', :description => 'description', :request => request, :response => response, :provider_state => 'some state') }
12
+ subject { described_class.new(interaction)}
13
+ let(:expected_hash) { {:response => generated_response, :request => as_json_with_options, :description => '' } }
14
+
15
+ before do
16
+ Pact::Reification.stub(:from_term).with(response).and_return(generated_response)
17
+ end
18
+
19
+ it "generates an actual response" do
20
+ Pact::Reification.should_receive(:from_term).with(response).and_return(generated_response)
21
+ expect(subject.as_json[:response]).to eq generated_response
22
+ end
23
+
24
+ it "includes the options in the request" do
25
+ expect(subject.as_json[:request]).to eq request_as_json
26
+ end
27
+
28
+ it "includes the provider state" do
29
+ expect(subject.as_json[:provider_state]).to eq 'some state'
30
+ end
31
+
32
+ it "includes the description" do
33
+ expect(subject.as_json[:description]).to eq 'description'
34
+ end
35
+
36
+ it "doesn't have any other keys" do
37
+ expect(subject.as_json.keys).to eq [:description, :provider_state, :request, :response]
38
+ end
39
+
40
+ context "without options" do
41
+ it "does not include the options key" do
42
+ expect(subject.as_json.key?(:options)).to be_false
43
+ end
44
+ end
45
+
46
+ context "with options" do
47
+ let(:options) { {:opts => 'blah'} }
48
+ it "includes the options in the request hash" do
49
+ expect(subject.as_json[:request][:options]).to eq options
50
+ end
51
+ end
52
+ end
53
+
54
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+ require 'support/shared_examples_for_request'
3
+
4
+ module Pact
5
+ describe Consumer::Request::Actual do
6
+ it_behaves_like "a request"
7
+
8
+ let(:raw_request) do
9
+ {
10
+ 'method' => 'get',
11
+ 'path' => '/mallory'
12
+ }
13
+ end
14
+
15
+ describe "from_hash" do
16
+ context "when field are not defined" do
17
+ subject { described_class.from_hash(raw_request) }
18
+ it "raises an error" do
19
+ expect{subject}.to raise_error KeyError
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -45,7 +45,7 @@ module Pact
45
45
  describe ".from_json" do
46
46
  let(:loaded_pact) { ConsumerContract.from_json(string) }
47
47
  context "when the top level object is a ConsumerContract" do
48
- let(:string) { '{"interactions":[{"request": {"path":"/path", "method" : "get"}}], "consumer": {"name" : "Bob"} }' }
48
+ let(:string) { '{"interactions":[{"request": {"path":"/path", "method" : "get"}}], "consumer": {"name" : "Bob"} , "provider": {"name" : "Mary"} }' }
49
49
 
50
50
  it "should create a Pact" do
51
51
  loaded_pact.should be_instance_of ConsumerContract
@@ -39,40 +39,6 @@ module Pact
39
39
  end
40
40
  end
41
41
 
42
- describe "as_json_for_mock_service" do
43
- let(:as_json_with_options ) { {:opts => 'blah'} }
44
- let(:request) { double(Pact::Request::Expected, :as_json_with_options => {:opts => 'blah'})}
45
- let(:response) { double('response') }
46
- let(:generated_response ) { double('generated_response', :to_json => 'generated_response') }
47
- subject { Interaction.new(:description => 'description', :request => request, :response => response, :provider_state => 'some state')}
48
- let(:expected_hash) { {:response => generated_response, :request => as_json_with_options, :description => '' } }
49
-
50
- before do
51
- Reification.stub(:from_term).with(response).and_return(generated_response)
52
- end
53
-
54
- it "generates an actual response" do
55
- Reification.should_receive(:from_term).with(response).and_return(generated_response)
56
- expect(subject.as_json_for_mock_service[:response]).to eq generated_response
57
- end
58
-
59
- it "includes the options in the request" do
60
- expect(subject.as_json_for_mock_service[:request]).to eq as_json_with_options
61
- end
62
-
63
- it "includes the provider state" do
64
- expect(subject.as_json_for_mock_service[:provider_state]).to eq 'some state'
65
- end
66
-
67
- it "includes the description" do
68
- expect(subject.as_json_for_mock_service[:description]).to eq 'description'
69
- end
70
-
71
- it "doesn't have any other keys" do
72
- expect(subject.as_json_for_mock_service.keys).to eq [:response, :request, :description, :provider_state]
73
- end
74
- end
75
-
76
42
  describe "to JSON" do
77
43
  let(:request) do
78
44
  {
@@ -1,107 +1,35 @@
1
1
  require 'spec_helper'
2
- require 'pact/request'
2
+ require 'pact/consumer_contract/request'
3
+ require 'pact/consumer/request'
4
+ require 'support/shared_examples_for_request'
3
5
 
4
- shared_examples "a request" do
5
-
6
- describe 'matching' do
7
- let(:expected) do
8
- Pact::Request::Expected.from_hash(
9
- {'method' => 'get', 'path' => 'path', 'query' => /b/}
10
- )
11
- end
12
-
13
- let(:actual) do
14
- Pact::Request::Actual.from_hash({'method' => 'get', 'path' => 'path', 'query' => 'blah'})
15
- end
16
-
17
- it "should match" do
18
- expect(expected.difference(actual)).to eq({})
19
- end
20
- end
21
-
22
- describe 'full_path' do
23
- context "with empty path" do
24
- subject { described_class.from_hash({:path => '', :method => 'get'}) }
25
- it "returns the full path"do
26
- expect(subject.full_path).to eq "/"
27
- end
28
- end
29
- context "with a path" do
30
- subject { described_class.from_hash({:path => '/path', :method => 'get'}) }
31
- it "returns the full path"do
32
- expect(subject.full_path).to eq "/path"
33
- end
34
- end
35
- context "with a path and query" do
36
- subject { described_class.from_hash({:path => '/path', :method => 'get', :query => "something"}) }
37
- it "returns the full path"do
38
- expect(subject.full_path).to eq "/path?something"
39
- end
40
- end
41
- end
6
+ module Pact
42
7
 
43
- describe "building from a hash" do
8
+ describe Request::Expected do
9
+ it_behaves_like "a request"
44
10
 
45
11
  let(:raw_request) do
46
12
  {
47
13
  'method' => 'get',
48
- 'path' => '/mallory',
49
- 'headers' => {
50
- 'Content-Type' => 'application/json'
51
- },
52
- 'body' => 'hello mallory'
14
+ 'path' => '/mallory'
53
15
  }
54
16
  end
55
17
 
56
- subject { described_class.from_hash(raw_request) }
57
-
58
- its(:method) { should == 'get' }
59
- its(:path) { should == '/mallory' }
60
- its(:body) { should == 'hello mallory' }
61
- its(:query) { should eq Pact::Request::NullExpectation.new }
62
-
63
- it "blows up if method is absent" do
64
- raw_request.delete 'method'
65
- expect { described_class.from_hash(raw_request) }.to raise_error
66
- end
67
-
68
- it "blows up if path is absent" do
69
- raw_request.delete 'path'
70
- expect { described_class.from_hash(raw_request) }.to raise_error
71
- end
72
-
73
- it "does not blow up if body is missing" do
74
- raw_request.delete 'body'
75
- expect { described_class.from_hash(raw_request) }.to_not raise_error
76
- end
77
-
78
- end
79
- end
80
-
81
- module Pact
82
-
83
- describe Request::Expected do
84
- it_behaves_like "a request"
85
-
86
- describe "as_json_with_options" do
87
- subject { Request::Expected.new(:get, '/path', {:header => 'value'}, {:body => 'yeah'}, "query", options) }
88
- context "with options" do
89
- let(:options) { {some: 'options'} }
90
- it "includes the options" do
91
- expect(subject.as_json_with_options[:options]).to eq options
92
- end
93
- end
94
- context "without options" do
95
- let(:options) { {} }
96
- it "does not include the options" do
97
- expect(subject.as_json_with_options.key?(:options)).to be_false
18
+ describe "from_hash" do
19
+ context "when optional field are not defined" do
20
+ subject { described_class.from_hash(raw_request) }
21
+ it "sets their values to NullExpectation" do
22
+ expect(subject.body).to be_instance_of(Pact::NullExpectation)
23
+ expect(subject.query).to be_instance_of(Pact::NullExpectation)
24
+ expect(subject.headers).to be_instance_of(Pact::NullExpectation)
98
25
  end
99
26
  end
100
- end
27
+ end
28
+
101
29
  describe "as_json" do
102
30
  subject { Request::Expected.new(:get, '/path', {:header => 'value'}, {:body => 'yeah'}, "query", {some: 'options'}) }
103
31
  context "with options" do
104
- it "does not include the options" do
32
+ it "does not include the options because they are a temporary hack and should leave no trace of themselves in the pact file" do
105
33
  expect(subject.as_json.key?(:options)).to be_false
106
34
  end
107
35
  end
@@ -114,20 +42,20 @@ module Pact
114
42
 
115
43
  let(:expected_method) { 'get' }
116
44
  let(:expected_path) { '/foo' }
117
- let(:expected_headers) { nil }
118
- let(:expected_body) { nil }
45
+ let(:expected_headers) { Pact::NullExpectation.new }
46
+ let(:expected_body) { Pact::NullExpectation.new }
119
47
  let(:expected_query) { '' }
120
48
 
121
- let(:actual_request) { Request::Actual.new(actual_method, actual_path, actual_headers, actual_body, actual_query) }
49
+ let(:actual_request) { Consumer::Request::Actual.new(actual_method, actual_path, actual_headers, actual_body, actual_query) }
122
50
 
123
51
  let(:actual_method) { 'get' }
124
52
  let(:actual_path) { '/foo' }
125
- let(:actual_headers) { nil }
126
- let(:actual_body) { nil }
53
+ let(:actual_headers) { {} }
54
+ let(:actual_body) { '' }
127
55
  let(:actual_query) { '' }
128
56
 
129
57
  it "matches identical requests" do
130
- expect(subject.match actual_request).to be_true
58
+ expect(subject.matches? actual_request).to be_true
131
59
  end
132
60
 
133
61
  context "when the methods are the same but one is symbolized" do
@@ -135,7 +63,7 @@ module Pact
135
63
  let(:actual_method) { 'get' }
136
64
 
137
65
  it "matches" do
138
- expect(subject.match actual_request).to be_true
66
+ expect(subject.matches? actual_request).to be_true
139
67
  end
140
68
  end
141
69
 
@@ -144,7 +72,7 @@ module Pact
144
72
  let(:actual_method) { 'post' }
145
73
 
146
74
  it "does not match" do
147
- expect(subject.match actual_request).to be_false
75
+ expect(subject.matches? actual_request).to be_false
148
76
  end
149
77
  end
150
78
 
@@ -153,7 +81,7 @@ module Pact
153
81
  let(:actual_path) { '/bar' }
154
82
 
155
83
  it "does not match" do
156
- expect(subject.match actual_request).to be_false
84
+ expect(subject.matches? actual_request).to be_false
157
85
  end
158
86
  end
159
87
 
@@ -162,7 +90,7 @@ module Pact
162
90
  let(:actual_path) { '/foo/' }
163
91
 
164
92
  it "matches" do
165
- expect(subject.match actual_request).to be_true
93
+ expect(subject.matches? actual_request).to be_true
166
94
  end
167
95
  end
168
96
 
@@ -171,16 +99,16 @@ module Pact
171
99
  let(:actual_body) { '' }
172
100
 
173
101
  it "does not match" do
174
- expect(subject.match actual_request).to be_false
102
+ expect(subject.matches? actual_request).to be_false
175
103
  end
176
104
  end
177
105
 
178
106
  context "when the expected body has no expectation and the actual body is empty" do
179
- let(:expected_body) { Request::NullExpectation.new }
107
+ let(:expected_body) { Pact::NullExpectation.new }
180
108
  let(:actual_body) { '' }
181
109
 
182
110
  it "matches" do
183
- expect(subject.match actual_request).to be_true
111
+ expect(subject.matches? actual_request).to be_true
184
112
  end
185
113
  end
186
114
 
@@ -194,7 +122,7 @@ module Pact
194
122
  let(:actual_body) { nil }
195
123
 
196
124
  it "does not match" do
197
- expect(subject.match actual_request).to be_false
125
+ expect(subject.matches? actual_request).to be_false
198
126
  end
199
127
  end
200
128
 
@@ -203,7 +131,7 @@ module Pact
203
131
  let(:actual_body) { 'bar' }
204
132
 
205
133
  it "does not match" do
206
- expect(subject.match actual_request).to be_false
134
+ expect(subject.matches? actual_request).to be_false
207
135
  end
208
136
  end
209
137
 
@@ -223,7 +151,7 @@ module Pact
223
151
  end
224
152
 
225
153
  it "matches" do
226
- expect(subject.match actual_request).to be_true
154
+ expect(subject.matches? actual_request).to be_true
227
155
  end
228
156
  end
229
157
 
@@ -243,7 +171,7 @@ module Pact
243
171
  end
244
172
 
245
173
  it "does not match" do
246
- expect(subject.match actual_request).to be_false
174
+ expect(subject.matches? actual_request).to be_false
247
175
  end
248
176
  end
249
177
 
@@ -263,7 +191,7 @@ module Pact
263
191
  end
264
192
 
265
193
  it "matches" do
266
- expect(subject.match actual_request).to be_true
194
+ expect(subject.matches? actual_request).to be_true
267
195
  end
268
196
  end
269
197
 
@@ -283,7 +211,7 @@ module Pact
283
211
  end
284
212
 
285
213
  it "does not match" do
286
- expect(subject.match actual_request).to be_false
214
+ expect(subject.matches? actual_request).to be_false
287
215
  end
288
216
  end
289
217
 
@@ -303,7 +231,7 @@ module Pact
303
231
  end
304
232
 
305
233
  it "does not match" do
306
- expect(subject.match actual_request).to be_false
234
+ expect(subject.matches? actual_request).to be_false
307
235
  end
308
236
  end
309
237
  context "when the expected body contains non-matching hash where one field contains a substring of the other" do
@@ -320,7 +248,7 @@ module Pact
320
248
  end
321
249
 
322
250
  it "does not match" do
323
- expect(subject.match actual_request).to be_false
251
+ expect(subject.matches? actual_request).to be_false
324
252
  end
325
253
  end
326
254
 
@@ -340,7 +268,7 @@ module Pact
340
268
  end
341
269
 
342
270
  it "does not match" do
343
- expect(subject.match actual_request).to be_true
271
+ expect(subject.matches? actual_request).to be_true
344
272
  end
345
273
  end
346
274
 
@@ -349,16 +277,16 @@ module Pact
349
277
  let(:actual_query) { 'bar' }
350
278
 
351
279
  it "does not match" do
352
- expect(subject.match actual_request).to be_false
280
+ expect(subject.matches? actual_request).to be_false
353
281
  end
354
282
  end
355
283
 
356
284
  context 'when there is no query expectation' do
357
- let(:expected_query) { Request::NullExpectation.new }
285
+ let(:expected_query) { Pact::NullExpectation.new }
358
286
  let(:actual_query) { 'bar' }
359
287
 
360
288
  it 'matches' do
361
- expect(subject.match actual_request).to be_true
289
+ expect(subject.matches? actual_request).to be_true
362
290
  end
363
291
  end
364
292
 
@@ -367,7 +295,7 @@ module Pact
367
295
  let(:expected_body) { { thing: "123" } }
368
296
 
369
297
  it 'does not match' do
370
- expect(subject.match actual_request).to be_false
298
+ expect(subject.matches? actual_request).to be_false
371
299
  end
372
300
  end
373
301
 
@@ -377,20 +305,16 @@ module Pact
377
305
  context "when allowing unexpected keys" do
378
306
  let(:options) { {'allow_unexpected_keys_in_body' => true} } #From json, these will be strings
379
307
  it "matches" do
380
- expect(subject.match actual_request).to be_true
308
+ expect(subject.matches? actual_request).to be_true
381
309
  end
382
310
  end
383
311
  context "when not allowing unexpected keys" do
384
312
  let(:options) { {'allow_unexpected_keys_in_body' => false} }
385
313
  it "does not match" do
386
- expect(subject.match actual_request).to be_false
314
+ expect(subject.matches? actual_request).to be_false
387
315
  end
388
316
  end
389
317
  end
390
318
  end
391
319
  end
392
-
393
- describe Request::Actual do
394
- it_behaves_like "a request"
395
- end
396
320
  end