pact-support 0.5.9 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +16 -0
- data/Appraisals +7 -0
- data/CHANGELOG.md +3 -0
- data/README.md +2 -1
- data/gemfiles/default.gemfile +5 -0
- data/gemfiles/ruby_under_22.gemfile +8 -0
- data/lib/pact/consumer_contract/interaction.rb +6 -1
- data/lib/pact/errors.rb +21 -0
- data/lib/pact/matchers/list_diff_formatter.rb +2 -0
- data/lib/pact/matchers/matchers.rb +0 -1
- data/lib/pact/support/version.rb +1 -1
- data/pact-support.gemspec +2 -1
- data/spec/lib/pact/consumer_contract/interaction_spec.rb +20 -0
- metadata +35 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 563b924005bc26322d374fe14dfbbd4a5e1b9512
|
4
|
+
data.tar.gz: 709ff4ddd7ef76fec9054be1e95aa3bcc26fc7af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf61f47a0ecf8c6b90f9f7f7ab6bf6a4ea64bc1ba136400adb291ba91cf3fa123d8f4272152de0df261ba92df7612743a1f00e4fe1b09946bed54ba93063fe63
|
7
|
+
data.tar.gz: dba94a800b1809bca6f1d34a0ff25749f7d8aec500f1edb02ba5c2569dd6a9d89f1d93c64249aa8e211ac5bd26b5607fb16b47ca4572d398bc8a32dfa0d83ce8
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -5,3 +5,19 @@ rvm:
|
|
5
5
|
- 2.2.4
|
6
6
|
- 2.3.1
|
7
7
|
- jruby-9.0.5.0
|
8
|
+
gemfile:
|
9
|
+
- gemfiles/default.gemfile
|
10
|
+
- gemfiles/ruby_under_22.gemfile
|
11
|
+
matrix:
|
12
|
+
exclude:
|
13
|
+
# rack 2.0 and activesupport 5.0 no longer support ruby under 2.2.
|
14
|
+
- rvm: 2.0.0
|
15
|
+
gemfile: gemfiles/default.gemfile
|
16
|
+
- rvm: 2.1.8
|
17
|
+
gemfile: gemfiles/default.gemfile
|
18
|
+
- rvm: 2.2.4
|
19
|
+
gemfile: gemfiles/ruby_under_22.gemfile
|
20
|
+
- rvm: 2.3.1
|
21
|
+
gemfile: gemfiles/ruby_under_22.gemfile
|
22
|
+
- rvm: jruby-9.0.5.0
|
23
|
+
gemfile: gemfiles/ruby_under_22.gemfile
|
data/Appraisals
ADDED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,9 @@ Do this to generate your change history
|
|
2
2
|
|
3
3
|
git log --pretty=format:' * %h - %s (%an, %ad)' vX.Y.Z..HEAD
|
4
4
|
|
5
|
+
### 0.6.0 (14 Nov 2016)
|
6
|
+
* 64a9a37 - Enable interactions to validate themselves (Taiki Ono, Wed Nov 9 19:08:49 2016 +0900)
|
7
|
+
|
5
8
|
### 0.5.9 (27 Jun 2016)
|
6
9
|
* dea4645 - Clarify that pact-support will only work with ruby >= 2.0 (Sergei Matheson, Mon Jun 27 10:18:32 2016 +1000)
|
7
10
|
* 50ea21f - Update json_differ.rb (Beth Skurrie, Thu Jun 9 16:01:34 2016 +1000)
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@ require 'pact/consumer_contract/response'
|
|
3
3
|
require 'pact/symbolize_keys'
|
4
4
|
require 'pact/shared/active_support_support'
|
5
5
|
require 'pact/matching_rules'
|
6
|
+
require 'pact/errors'
|
6
7
|
|
7
8
|
module Pact
|
8
9
|
class Interaction
|
@@ -35,6 +36,10 @@ module Pact
|
|
35
36
|
}
|
36
37
|
end
|
37
38
|
|
39
|
+
def validate!
|
40
|
+
raise Pact::InvalidInteractionError.new(self) unless description && request && response
|
41
|
+
end
|
42
|
+
|
38
43
|
def matches_criteria? criteria
|
39
44
|
criteria.each do | key, value |
|
40
45
|
unless match_criterion self.send(key.to_s), value
|
@@ -68,4 +73,4 @@ module Pact
|
|
68
73
|
to_hash.to_s
|
69
74
|
end
|
70
75
|
end
|
71
|
-
end
|
76
|
+
end
|
data/lib/pact/errors.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Pact
|
2
|
+
class Error < ::StandardError
|
3
|
+
end
|
4
|
+
|
5
|
+
# Raised when the interaction is not defined correctly
|
6
|
+
class InvalidInteractionError < Error
|
7
|
+
def initialize(interaction)
|
8
|
+
super(build_message(interaction))
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def build_message(interaction)
|
14
|
+
missing_attributes = []
|
15
|
+
missing_attributes << :description unless interaction.description
|
16
|
+
missing_attributes << :request unless interaction.request
|
17
|
+
missing_attributes << :response unless interaction.response
|
18
|
+
"Missing attributes: #{missing_attributes}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/pact/support/version.rb
CHANGED
data/pact-support.gemspec
CHANGED
@@ -22,11 +22,11 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_runtime_dependency 'randexp', '~> 0.1.7'
|
23
23
|
gem.add_runtime_dependency 'rspec', '>=2.14'
|
24
24
|
gem.add_runtime_dependency 'rack-test', '~> 0.6.2'
|
25
|
-
gem.add_runtime_dependency 'awesome_print', '~> 1.1'
|
26
25
|
gem.add_runtime_dependency 'json'
|
27
26
|
gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
|
28
27
|
gem.add_runtime_dependency 'find_a_port', '~> 1.0.1'
|
29
28
|
gem.add_runtime_dependency 'thor'
|
29
|
+
gem.add_runtime_dependency 'awesome_print', '~> 1.1'
|
30
30
|
|
31
31
|
gem.add_development_dependency 'rake', '~> 10.0.3'
|
32
32
|
gem.add_development_dependency 'webmock', '~> 2.0.0'
|
@@ -34,4 +34,5 @@ Gem::Specification.new do |gem|
|
|
34
34
|
gem.add_development_dependency 'fakefs', '~> 0.4'
|
35
35
|
gem.add_development_dependency 'hashie', '~> 2.0'
|
36
36
|
gem.add_development_dependency 'activesupport'
|
37
|
+
gem.add_development_dependency 'appraisal'
|
37
38
|
end
|
@@ -118,7 +118,27 @@ module Pact
|
|
118
118
|
expect(subject).to be false
|
119
119
|
end
|
120
120
|
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "#validate!" do
|
124
|
+
let(:interaction) { InteractionFactory.create }
|
125
|
+
|
126
|
+
context "when it lacks necessary data" do
|
127
|
+
before { interaction.description = nil }
|
128
|
+
|
129
|
+
it "raises Pact::InvalidInteractionError" do
|
130
|
+
expect { interaction.validate! }.to(raise_error(Pact::InvalidInteractionError) do |e|
|
131
|
+
expect(e.message).to include("description")
|
132
|
+
expect(e.message).not_to include("request")
|
133
|
+
end)
|
134
|
+
end
|
135
|
+
end
|
121
136
|
|
137
|
+
context "when it has all necessary data" do
|
138
|
+
it "does not raise any errors" do
|
139
|
+
expect { interaction.validate! }.not_to raise_error
|
140
|
+
end
|
141
|
+
end
|
122
142
|
end
|
123
143
|
end
|
124
144
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Fraser
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-
|
15
|
+
date: 2016-11-13 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|
@@ -56,20 +56,6 @@ dependencies:
|
|
56
56
|
- - "~>"
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: 0.6.2
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: awesome_print
|
61
|
-
requirement: !ruby/object:Gem::Requirement
|
62
|
-
requirements:
|
63
|
-
- - "~>"
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: '1.1'
|
66
|
-
type: :runtime
|
67
|
-
prerelease: false
|
68
|
-
version_requirements: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
70
|
-
- - "~>"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '1.1'
|
73
59
|
- !ruby/object:Gem::Dependency
|
74
60
|
name: json
|
75
61
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,6 +112,20 @@ dependencies:
|
|
126
112
|
- - ">="
|
127
113
|
- !ruby/object:Gem::Version
|
128
114
|
version: '0'
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: awesome_print
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - "~>"
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '1.1'
|
122
|
+
type: :runtime
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - "~>"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '1.1'
|
129
129
|
- !ruby/object:Gem::Dependency
|
130
130
|
name: rake
|
131
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,6 +210,20 @@ dependencies:
|
|
210
210
|
- - ">="
|
211
211
|
- !ruby/object:Gem::Version
|
212
212
|
version: '0'
|
213
|
+
- !ruby/object:Gem::Dependency
|
214
|
+
name: appraisal
|
215
|
+
requirement: !ruby/object:Gem::Requirement
|
216
|
+
requirements:
|
217
|
+
- - ">="
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '0'
|
220
|
+
type: :development
|
221
|
+
prerelease: false
|
222
|
+
version_requirements: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - ">="
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '0'
|
213
227
|
description:
|
214
228
|
email:
|
215
229
|
- james.fraser@alumni.swinburne.edu
|
@@ -224,12 +238,15 @@ files:
|
|
224
238
|
- ".gitignore"
|
225
239
|
- ".rspec"
|
226
240
|
- ".travis.yml"
|
241
|
+
- Appraisals
|
227
242
|
- CHANGELOG.md
|
228
243
|
- Gemfile
|
229
244
|
- LICENSE.txt
|
230
245
|
- README.md
|
231
246
|
- RELEASING.md
|
232
247
|
- Rakefile
|
248
|
+
- gemfiles/default.gemfile
|
249
|
+
- gemfiles/ruby_under_22.gemfile
|
233
250
|
- lib/pact/array_like.rb
|
234
251
|
- lib/pact/configuration.rb
|
235
252
|
- lib/pact/consumer/request.rb
|
@@ -246,6 +263,7 @@ files:
|
|
246
263
|
- lib/pact/consumer_contract/response.rb
|
247
264
|
- lib/pact/consumer_contract/service_consumer.rb
|
248
265
|
- lib/pact/consumer_contract/service_provider.rb
|
266
|
+
- lib/pact/errors.rb
|
249
267
|
- lib/pact/helpers.rb
|
250
268
|
- lib/pact/logging.rb
|
251
269
|
- lib/pact/matchers.rb
|
@@ -373,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
373
391
|
version: '0'
|
374
392
|
requirements: []
|
375
393
|
rubyforge_project:
|
376
|
-
rubygems_version: 2.5
|
394
|
+
rubygems_version: 2.4.5
|
377
395
|
signing_key:
|
378
396
|
specification_version: 4
|
379
397
|
summary: Shared code for Pact gems
|