pact-support 1.1.7 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/lib/pact/matchers/matchers.rb +7 -7
- data/lib/pact/support/version.rb +1 -1
- data/spec/lib/pact/matchers/matchers_spec.rb +8 -8
- data/spec/spec_helper.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1bd725ba74d2e30a46cc0c1d0bba62e309955e1
|
4
|
+
data.tar.gz: 48a32edcbebdce428cf7debb689e057c2303b3cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 348730f0cd0c9fb8260d145b317ae44e41690cf69e91104506215b1f8549b4134b0f2d8d4fd16e66816ed1547cd233d55371eda65cf4c88d2a091cb875a44d5f
|
7
|
+
data.tar.gz: b942073bd4f903dabf1e086c60413695c57056ed8e138aa0a7c007a044a9bfed7f491744f086343f6bf34e52d0b4577f29ed3491e03b48020984cf85da825cd6
|
data/.gitignore
CHANGED
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)'
|
4
4
|
|
5
|
+
### 1.1.8 (2017-09-25)
|
6
|
+
* d4029ab - fix: use reified value when creating diff message for arrays (Beth Skurrie, Fri Sep 22 10:57:01 2017 +1000)
|
7
|
+
|
5
8
|
### 1.1.7 (2017-09-15)
|
6
9
|
* a339b52 - Gemspec: Try using FakeFS 0.11.2 (Olle Jonsson, Wed Sep 13 09:28:27 2017 +0200)
|
7
10
|
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Pact Support
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/pact-foundation/pact-support.svg?branch=master)](https://travis-ci.org/
|
3
|
+
[![Build Status](https://travis-ci.org/pact-foundation/pact-support.svg?branch=master)](https://travis-ci.org/pact-foundation/pact-support)
|
4
4
|
|
5
5
|
Provides shared code for the Pact gems
|
@@ -56,7 +56,7 @@ module Pact
|
|
56
56
|
if actual.is_a?(String)
|
57
57
|
actual_term_diff term, actual, options
|
58
58
|
else
|
59
|
-
RegexpDifference.new term.matcher,
|
59
|
+
RegexpDifference.new term.matcher, actual, "Expected a String matching #{term.matcher.inspect} (like #{term.generate.inspect}) but got #{class_name_with_value_in_brackets(actual)} at <path>"
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -64,7 +64,7 @@ module Pact
|
|
64
64
|
if term.matcher.match(actual)
|
65
65
|
NO_DIFF
|
66
66
|
else
|
67
|
-
RegexpDifference.new term.matcher,
|
67
|
+
RegexpDifference.new term.matcher, actual, "Expected a String matching #{term.matcher.inspect} (like #{term.generate.inspect}) but got #{actual.inspect} at <path>"
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -72,7 +72,7 @@ module Pact
|
|
72
72
|
if actual.is_a?(String)
|
73
73
|
actual_regexp_diff regexp, actual, options
|
74
74
|
else
|
75
|
-
RegexpDifference.new regexp,
|
75
|
+
RegexpDifference.new regexp, actual, "Expected a String matching #{regexp.inspect} but got #{class_name_with_value_in_brackets(actual)} at <path>"
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -80,7 +80,7 @@ module Pact
|
|
80
80
|
if regexp.match(actual)
|
81
81
|
NO_DIFF
|
82
82
|
else
|
83
|
-
RegexpDifference.new regexp,
|
83
|
+
RegexpDifference.new regexp, actual, "Expected a String matching #{regexp.inspect} but got #{short_description(actual)} at <path>"
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -88,7 +88,7 @@ module Pact
|
|
88
88
|
if actual.is_a? Array
|
89
89
|
actual_array_diff expected, actual, options
|
90
90
|
else
|
91
|
-
Difference.new Pact::Reification.from_term(expected), Pact::Reification.from_term(
|
91
|
+
Difference.new Pact::Reification.from_term(expected), actual, type_difference_message(Pact::Reification.from_term(expected), actual)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -115,7 +115,7 @@ module Pact
|
|
115
115
|
expected_array = expected_size.times.collect{ Pact::Term.unpack_regexps(array_like.contents) }
|
116
116
|
actual_array_diff expected_array, actual, options.merge(:type => true)
|
117
117
|
else
|
118
|
-
Difference.new array_like.generate,
|
118
|
+
Difference.new array_like.generate, actual, type_difference_message(expected, actual)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
@@ -123,7 +123,7 @@ module Pact
|
|
123
123
|
if actual.is_a? Hash
|
124
124
|
actual_hash_diff expected, actual, options
|
125
125
|
else
|
126
|
-
Difference.new Pact::Reification.from_term(expected), Pact::Reification.from_term(
|
126
|
+
Difference.new Pact::Reification.from_term(expected), actual, type_difference_message(Pact::Reification.from_term(expected), actual)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
data/lib/pact/support/version.rb
CHANGED
@@ -55,7 +55,7 @@ module Pact::Matchers
|
|
55
55
|
|
56
56
|
context 'when the there is a mismatch of a parent, and a child contains a SomethingLike' do
|
57
57
|
let(:expected) { {thing: {foo: Pact::SomethingLike.new(1)}} }
|
58
|
-
let(:actual) { {thing: [
|
58
|
+
let(:actual) { {thing: [1]} }
|
59
59
|
let(:difference) { {thing: Difference.new({foo: 1}, [1]) } }
|
60
60
|
|
61
61
|
it "reifies the children" do
|
@@ -126,7 +126,7 @@ module Pact::Matchers
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
context "and nil is found" do
|
129
|
-
let(:actual) { {a: nil}}
|
129
|
+
let(:actual) { {a: nil} }
|
130
130
|
let(:difference ) { {a: TypeDifference.new(Pact::ExpectedType.new(1), Pact::ActualType.new(nil)) } }
|
131
131
|
it "returns the diff" do
|
132
132
|
expect(type_diff(expected, actual)).to eq difference
|
@@ -222,8 +222,8 @@ module Pact::Matchers
|
|
222
222
|
describe 'diffing' do
|
223
223
|
|
224
224
|
context "when expected is longer than the actual" do
|
225
|
-
subject { [1,2,3] }
|
226
|
-
let(:actual) { [1,2]}
|
225
|
+
subject { [1, 2, 3] }
|
226
|
+
let(:actual) { [1, 2] }
|
227
227
|
let(:difference) { [NoDiffAtIndex.new, NoDiffAtIndex.new, Difference.new(3, Pact::IndexNotFound.new)] }
|
228
228
|
it 'returns the diff' do
|
229
229
|
expect(diff(subject, actual)).to eq(difference)
|
@@ -276,7 +276,7 @@ module Pact::Matchers
|
|
276
276
|
|
277
277
|
context "when the actual value is an array, and both expected and actual contain SomethingLike" do
|
278
278
|
subject { {a: {foo: Pact.like("b")}} }
|
279
|
-
let(:actual) { {a: [
|
279
|
+
let(:actual) { {a: [1] } }
|
280
280
|
let(:difference) { {a: Difference.new({foo: "b"}, [1]) } }
|
281
281
|
|
282
282
|
it "should return the diff with the reified likes" do
|
@@ -480,7 +480,7 @@ module Pact::Matchers
|
|
480
480
|
|
481
481
|
context "where an array is expected, but a hash is found" do
|
482
482
|
subject { {:a => :b} }
|
483
|
-
let(:actual) { [4,5,6] }
|
483
|
+
let(:actual) { [4, 5, 6] }
|
484
484
|
|
485
485
|
it 'includes this in the diff' do
|
486
486
|
expect(diff(subject, actual)).to eq(Difference.new({:a => :b}, [4,5,6] ))
|
@@ -498,7 +498,7 @@ module Pact::Matchers
|
|
498
498
|
|
499
499
|
context "when two different arrays are found" do
|
500
500
|
subject { [4,5,6] }
|
501
|
-
let(:actual) { [4,6,7] }
|
501
|
+
let(:actual) { [4, 6, 7] }
|
502
502
|
let(:difference) { [NoDiffAtIndex.new, Difference.new(5, 6), Difference.new(6, 7)] }
|
503
503
|
|
504
504
|
it 'includes this in the diff' do
|
@@ -508,7 +508,7 @@ module Pact::Matchers
|
|
508
508
|
|
509
509
|
context "when an array that matches the Pact::Term is found" do
|
510
510
|
subject { [Pact::Term.new(:matcher => /4/, :generate => '4'),"5","6"] }
|
511
|
-
let(:actual) { ["4","5","6"] }
|
511
|
+
let(:actual) { ["4", "5", "6"] }
|
512
512
|
|
513
513
|
it 'includes this in the diff' do
|
514
514
|
expect(diff(subject, actual)).to eq({})
|
data/spec/spec_helper.rb
CHANGED
@@ -12,5 +12,7 @@ RSpec.configure do | config |
|
|
12
12
|
config.include(FakeFS::SpecHelpers, :fakefs => true)
|
13
13
|
|
14
14
|
config.include Pact::SpecSupport
|
15
|
+
if config.respond_to?(:example_status_persistence_file_path=)
|
16
|
+
config.example_status_persistence_file_path = "./spec/examples.txt"
|
17
|
+
end
|
15
18
|
end
|
16
|
-
|
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: 1.1.
|
4
|
+
version: 1.1.8
|
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: 2017-09-
|
15
|
+
date: 2017-09-24 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|
@@ -396,7 +396,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
396
396
|
version: '0'
|
397
397
|
requirements: []
|
398
398
|
rubyforge_project:
|
399
|
-
rubygems_version: 2.6.
|
399
|
+
rubygems_version: 2.6.12
|
400
400
|
signing_key:
|
401
401
|
specification_version: 4
|
402
402
|
summary: Shared code for Pact gems
|