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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8332f5346c4cc2cab4115702bace6cacdcfaa727
4
- data.tar.gz: f64dfa7882eb26521ef44330df6801f802245029
3
+ metadata.gz: 563b924005bc26322d374fe14dfbbd4a5e1b9512
4
+ data.tar.gz: 709ff4ddd7ef76fec9054be1e95aa3bcc26fc7af
5
5
  SHA512:
6
- metadata.gz: ed7b69cac96db9188a9e91bbf0441d627e7202789d6beba8d7f283f390280a43b47a5de1e9c525d6147761571d87c61454dbdd5778ebe6631006886d504c04bb
7
- data.tar.gz: 7837ef35f030837c9451bbbc679d5db603e3473175b9ba624ee15921225d2f8f67ec0b400757fea0b807e037ae81847d1e747dda940b5faac74090bb2fb87d91
6
+ metadata.gz: bf61f47a0ecf8c6b90f9f7f7ab6bf6a4ea64bc1ba136400adb291ba91cf3fa123d8f4272152de0df261ba92df7612743a1f00e4fe1b09946bed54ba93063fe63
7
+ data.tar.gz: dba94a800b1809bca6f1d34a0ff25749f7d8aec500f1edb02ba5c2569dd6a9d89f1d93c64249aa8e211ac5bd26b5607fb16b47ca4572d398bc8a32dfa0d83ce8
data/.gitignore CHANGED
@@ -27,4 +27,5 @@ spec/pacts
27
27
  log
28
28
  .idea
29
29
  reports
30
- Gemfile.lock
30
+ Gemfile.lock
31
+ gemfiles/*.lock
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
@@ -0,0 +1,7 @@
1
+ appraise "default" do
2
+ end
3
+
4
+ appraise "ruby-under-22" do
5
+ gem "rack", "< 2.0"
6
+ gem "activesupport", "< 5.0.0"
7
+ end
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
@@ -1,4 +1,5 @@
1
1
  # Pact Support
2
2
 
3
- Provides shared code for the Pact gems
3
+ [![Build Status](https://travis-ci.org/bethesque/pact-support.svg?branch=master)](https://travis-ci.org/bethesque/pact-support)
4
4
 
5
+ Provides shared code for the Pact gems
@@ -0,0 +1,5 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rack", "< 2.0"
6
+ gem "activesupport", "< 5.0.0"
7
+
8
+ gemspec :path => "../"
@@ -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
@@ -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
@@ -1,3 +1,5 @@
1
+ require 'awesome_print' # The .ai method comes from awesome_print
2
+
1
3
  module Pact
2
4
  module Matchers
3
5
  class ListDiffFormatter
@@ -1,4 +1,3 @@
1
- require 'awesome_print'
2
1
  require 'pact/term'
3
2
  require 'pact/something_like'
4
3
  require 'pact/shared/null_expectation'
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Support
3
- VERSION = "0.5.9"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
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.5.9
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-06-27 00:00:00.000000000 Z
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.1
394
+ rubygems_version: 2.4.5
377
395
  signing_key:
378
396
  specification_version: 4
379
397
  summary: Shared code for Pact gems