|
8 | 8 |
|
9 | 9 | let(:diff_formatter) { Pact::Matchers::UnixDiffFormatter }
|
10 | 10 |
|
11 |
| - it 'does not match a hash to an array' do |
| 11 | + it 'does not match a hash to an array' do | example | |
12 | 12 | expect({})
|
13 |
| - .to_not match_term([], with: Pact::JsonDiffer, diff_formatter: diff_formatter) |
| 13 | + .to_not match_term([], { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example) |
14 | 14 | end
|
15 | 15 |
|
16 |
| - it 'does not match an array to a hash' do |
| 16 | + it 'does not match an array to a hash' do | example | |
17 | 17 | expect([])
|
18 |
| - .to_not match_term({}, with: Pact::JsonDiffer, diff_formatter: diff_formatter) |
| 18 | + .to_not match_term({}, { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example) |
19 | 19 | end
|
20 | 20 |
|
21 |
| - it 'matches regular expressions' do |
| 21 | + it 'matches regular expressions' do | example | |
22 | 22 | expect('blah')
|
23 |
| - .to match_term(/[a-z]*/, with: Pact::JsonDiffer, diff_formatter: diff_formatter) |
| 23 | + .to match_term(/[a-z]*/, { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example) |
24 | 24 | end
|
25 | 25 |
|
26 |
| - it 'matches pact terms' do |
| 26 | + it 'matches pact terms' do | example | |
27 | 27 | expect('wootle')
|
28 |
| - .to match_term Pact.term(generate: 'wootle', matcher: /woot../), with: Pact::JsonDiffer, diff_formatter: diff_formatter |
| 28 | + .to match_term Pact.term(generate: 'wootle', matcher: /woot../), { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example |
29 | 29 | end
|
30 | 30 |
|
31 |
| - it 'matches all elements of arrays' do |
| 31 | + it 'matches all elements of arrays' do | example | |
32 | 32 | expect(['one', 'two', ['three']])
|
33 |
| - .to match_term [/one/, 'two', [Pact.term(generate: 'three', matcher: /thr../)]], with: Pact::JsonDiffer, diff_formatter: diff_formatter |
| 33 | + .to match_term [/one/, 'two', [Pact.term(generate: 'three', matcher: /thr../)]], { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example |
34 | 34 | end
|
35 | 35 |
|
36 |
| - it 'matches all values of hashes' do |
| 36 | + it 'matches all values of hashes' do | example | |
37 | 37 | expect({ 1 => 'one', 2 => 2, 3 => 'three' })
|
38 |
| - .to match_term({ 1 => /one/, 2 => 2, 3 => Pact.term(generate: 'three', matcher: /thr../) }, with: Pact::JsonDiffer, diff_formatter: diff_formatter) |
| 38 | + .to match_term({ 1 => /one/, 2 => 2, 3 => Pact.term(generate: 'three', matcher: /thr../) }, { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example) |
39 | 39 | end
|
40 | 40 |
|
41 |
| - it 'matches all other objects using ==' do |
42 |
| - expect('wootle').to match_term 'wootle', with: Pact::JsonDiffer, diff_formatter: diff_formatter |
| 41 | + it 'matches all other objects using ==' do | example | |
| 42 | + expect('wootle').to match_term 'wootle', { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example |
43 | 43 | end
|
44 | 44 |
|
45 | 45 | # Note: because a consumer specifies only the keys it cares about, the pact ignores keys that are returned
|
46 | 46 | # by the provider, but not are not specified in the pact. This means that any hash will match an
|
47 | 47 | # expected empty hash, because there is currently no way for a consumer to expect an absence of keys.
|
48 |
| - it 'is confused by an empty hash' do |
49 |
| - expect(hello: 'everyone').to match_term({}, with: Pact::JsonDiffer, diff_formatter: diff_formatter) |
| 48 | + it 'is confused by an empty hash' do | example | |
| 49 | + expect(hello: 'everyone').to match_term({}, { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example) |
50 | 50 | end
|
51 | 51 |
|
52 |
| - it 'should not be confused by an empty array' do |
53 |
| - expect(['blah']).to_not match_term([], with: Pact::JsonDiffer, diff_formatter: diff_formatter) |
| 52 | + it 'should not be confused by an empty array' do | example | |
| 53 | + expect(['blah']).to_not match_term([], { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example) |
54 | 54 | end
|
55 | 55 |
|
56 |
| - it "should allow matches on an array where each item in the array only contains a subset of the actual" do |
| 56 | + it "should allow matches on an array where each item in the array only contains a subset of the actual" do | example | |
57 | 57 | expect([{ name: 'Fred', age: 12 }, { name: 'John', age: 13 }])
|
58 |
| - .to match_term([{ name: 'Fred' }, { name: 'John' }], with: Pact::JsonDiffer, diff_formatter: diff_formatter) |
| 58 | + .to match_term([{ name: 'Fred' }, { name: 'John' }], { with: Pact::JsonDiffer, diff_formatter: diff_formatter }, example) |
59 | 59 | end
|
60 | 60 | end
|
0 commit comments