pact-support 1.9.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +124 -0
  3. data/lib/pact/configuration.rb +7 -0
  4. data/lib/pact/consumer_contract/consumer_contract.rb +12 -1
  5. data/lib/pact/consumer_contract/http_consumer_contract_parser.rb +1 -1
  6. data/lib/pact/consumer_contract/interaction.rb +5 -1
  7. data/lib/pact/consumer_contract/interaction_v2_parser.rb +9 -1
  8. data/lib/pact/consumer_contract/interaction_v3_parser.rb +22 -3
  9. data/lib/pact/consumer_contract/pact_file.rb +32 -1
  10. data/lib/pact/matchers/matchers.rb +33 -13
  11. data/lib/pact/matching_rules/v3/merge.rb +4 -2
  12. data/lib/pact/shared/multipart_form_differ.rb +2 -0
  13. data/lib/pact/support/version.rb +1 -1
  14. data/lib/pact/term.rb +0 -1
  15. metadata +5 -228
  16. data/.gitignore +0 -32
  17. data/.rspec +0 -3
  18. data/.travis.yml +0 -29
  19. data/Appraisals +0 -7
  20. data/Gemfile +0 -4
  21. data/RELEASING.md +0 -5
  22. data/Rakefile +0 -4
  23. data/gemfiles/default.gemfile +0 -5
  24. data/gemfiles/ruby_under_22.gemfile +0 -8
  25. data/pact-support.gemspec +0 -39
  26. data/script/release.sh +0 -9
  27. data/script/update-pact-specification-v2 +0 -9
  28. data/spec/fixtures/interaction-with-matching-rules.json +0 -27
  29. data/spec/fixtures/multipart-form-diff.txt +0 -9
  30. data/spec/fixtures/not-a-pact.json +0 -3
  31. data/spec/fixtures/pact-http-v2.json +0 -36
  32. data/spec/fixtures/pact-http-v3.json +0 -36
  33. data/spec/integration/matching_rules_extract_and_merge_spec.rb +0 -127
  34. data/spec/lib/pact/array_like_spec.rb +0 -37
  35. data/spec/lib/pact/configuration_spec.rb +0 -61
  36. data/spec/lib/pact/consumer/request_spec.rb +0 -25
  37. data/spec/lib/pact/consumer_contract/active_support_support_spec.rb +0 -58
  38. data/spec/lib/pact/consumer_contract/consumer_contract_spec.rb +0 -142
  39. data/spec/lib/pact/consumer_contract/file_name_spec.rb +0 -24
  40. data/spec/lib/pact/consumer_contract/headers_spec.rb +0 -107
  41. data/spec/lib/pact/consumer_contract/http_consumer_contract_parser_spec.rb +0 -25
  42. data/spec/lib/pact/consumer_contract/interaction_parser_spec.rb +0 -62
  43. data/spec/lib/pact/consumer_contract/interaction_spec.rb +0 -121
  44. data/spec/lib/pact/consumer_contract/interaction_v2_parser_spec.rb +0 -54
  45. data/spec/lib/pact/consumer_contract/interaction_v3_parser_spec.rb +0 -48
  46. data/spec/lib/pact/consumer_contract/pact_file_spec.rb +0 -204
  47. data/spec/lib/pact/consumer_contract/query_hash_spec.rb +0 -154
  48. data/spec/lib/pact/consumer_contract/query_string_spec.rb +0 -131
  49. data/spec/lib/pact/consumer_contract/request_spec.rb +0 -486
  50. data/spec/lib/pact/consumer_contract/response_spec.rb +0 -82
  51. data/spec/lib/pact/helpers_spec.rb +0 -143
  52. data/spec/lib/pact/matchers/differ_spec.rb +0 -215
  53. data/spec/lib/pact/matchers/difference_spec.rb +0 -22
  54. data/spec/lib/pact/matchers/embedded_diff_formatter_spec.rb +0 -90
  55. data/spec/lib/pact/matchers/extract_diff_messages_spec.rb +0 -78
  56. data/spec/lib/pact/matchers/index_not_found_spec.rb +0 -21
  57. data/spec/lib/pact/matchers/list_diff_formatter_spec.rb +0 -121
  58. data/spec/lib/pact/matchers/matchers_array_like_spec.rb +0 -222
  59. data/spec/lib/pact/matchers/matchers_messages_hash_and_array_spec.rb +0 -146
  60. data/spec/lib/pact/matchers/matchers_messages_mismatched_value_spec.rb +0 -71
  61. data/spec/lib/pact/matchers/matchers_messages_regexp_spec.rb +0 -103
  62. data/spec/lib/pact/matchers/matchers_spec.rb +0 -521
  63. data/spec/lib/pact/matchers/multipart_form_diff_formatter_spec.rb +0 -36
  64. data/spec/lib/pact/matchers/no_diff_at_index_spec.rb +0 -15
  65. data/spec/lib/pact/matchers/regexp_difference_spec.rb +0 -20
  66. data/spec/lib/pact/matchers/type_difference_spec.rb +0 -36
  67. data/spec/lib/pact/matchers/unexpected_index_spec.rb +0 -20
  68. data/spec/lib/pact/matchers/unexpected_key_spec.rb +0 -20
  69. data/spec/lib/pact/matchers/unix_diff_formatter_spec.rb +0 -235
  70. data/spec/lib/pact/matching_rules/extract_spec.rb +0 -216
  71. data/spec/lib/pact/matching_rules/merge_spec.rb +0 -436
  72. data/spec/lib/pact/matching_rules/v3/extract_spec.rb +0 -238
  73. data/spec/lib/pact/matching_rules/v3/merge_spec.rb +0 -485
  74. data/spec/lib/pact/matching_rules_spec.rb +0 -82
  75. data/spec/lib/pact/reification_spec.rb +0 -172
  76. data/spec/lib/pact/shared/dsl_spec.rb +0 -100
  77. data/spec/lib/pact/shared/form_differ_spec.rb +0 -71
  78. data/spec/lib/pact/shared/json_differ_spec.rb +0 -36
  79. data/spec/lib/pact/shared/key_not_found_spec.rb +0 -20
  80. data/spec/lib/pact/shared/multipart_form_differ_spec.rb +0 -39
  81. data/spec/lib/pact/shared/request_spec.rb +0 -235
  82. data/spec/lib/pact/shared/text_differ_spec.rb +0 -54
  83. data/spec/lib/pact/something_like_spec.rb +0 -23
  84. data/spec/lib/pact/support_spec.rb +0 -9
  85. data/spec/lib/pact/symbolize_keys_spec.rb +0 -15
  86. data/spec/lib/pact/term_spec.rb +0 -89
  87. data/spec/pact_specification/compliance-2.0.rb +0 -66
  88. data/spec/spec_helper.rb +0 -18
  89. data/spec/support/a_consumer-a_producer.json +0 -32
  90. data/spec/support/a_consumer-a_provider.json +0 -32
  91. data/spec/support/active_support_if_configured.rb +0 -6
  92. data/spec/support/case-insensitive-response-header-matching.json +0 -21
  93. data/spec/support/consumer_contract_template.json +0 -24
  94. data/spec/support/dsl_spec_support.rb +0 -7
  95. data/spec/support/factories.rb +0 -87
  96. data/spec/support/generated_index.md +0 -4
  97. data/spec/support/generated_markdown.md +0 -55
  98. data/spec/support/interaction_view_model.json +0 -63
  99. data/spec/support/interaction_view_model_with_terms.json +0 -50
  100. data/spec/support/markdown_pact.json +0 -48
  101. data/spec/support/missing_provider_states_output.txt +0 -25
  102. data/spec/support/options.json +0 -21
  103. data/spec/support/ruby_version_helpers.rb +0 -23
  104. data/spec/support/shared_examples_for_request.rb +0 -132
  105. data/spec/support/spec_support.rb +0 -29
  106. data/spec/support/stubbing.json +0 -22
  107. data/spec/support/term.json +0 -48
  108. data/spec/support/test_app_fail.json +0 -61
  109. data/spec/support/test_app_pass.json +0 -38
  110. data/spec/support/test_app_with_right_content_type_differ.json +0 -23
  111. data/tasks/release.rake +0 -5
  112. data/tasks/spec.rake +0 -14
@@ -1,142 +0,0 @@
1
- require 'spec_helper'
2
- require 'pact/consumer_contract'
3
-
4
- module Pact
5
- describe ConsumerContract do
6
- describe "from_uri" do
7
- context "when the URL does not point to a valid pact" do
8
- subject { ConsumerContract.from_uri('spec/fixtures/not-a-pact.json') }
9
-
10
- it "raises a helpful error" do
11
- expect { subject }.to raise_error UnrecognizePactFormatError, /Please check that spec/
12
- end
13
- end
14
- end
15
-
16
- describe "from_hash" do
17
- context "when the hash is not a valid pact" do
18
- subject { ConsumerContract.from_hash({'foo' => 'bar'}) }
19
-
20
- it "raises a helpful error" do
21
- expect { subject }.to raise_error UnrecognizePactFormatError, 'This document does not use a recognised Pact format: {"foo"=>"bar"}'
22
- end
23
- end
24
- end
25
-
26
- describe ".from_json" do
27
-
28
- let(:loaded_pact) { ConsumerContract.from_json(string) }
29
-
30
- context "with an HTTP contract" do
31
- context "when the top level object is a ConsumerContract" do
32
- let(:string) { '{"interactions":[{"request": {"path":"/path", "method" : "get"}, "response": {"status" : 200}}], "consumer": {"name" : "Bob"} , "provider": {"name" : "Mary"} }' }
33
-
34
- it "should create a Pact" do
35
- expect(loaded_pact).to be_instance_of ConsumerContract
36
- end
37
-
38
- it "should have interactions" do
39
- expect(loaded_pact.interactions).to be_instance_of Array
40
- end
41
-
42
- it "should have a consumer" do
43
- expect(loaded_pact.consumer).to be_instance_of Pact::ServiceConsumer
44
- end
45
-
46
- it "should have a provider" do
47
- expect(loaded_pact.provider).to be_instance_of Pact::ServiceProvider
48
- end
49
- end
50
-
51
- context "with old 'producer' key" do
52
- let(:string) { File.read('./spec/support/a_consumer-a_producer.json')}
53
- it "should create a Pact" do
54
- expect(loaded_pact).to be_instance_of ConsumerContract
55
- end
56
-
57
- it "should have interactions" do
58
- expect(loaded_pact.interactions).to be_instance_of Array
59
- end
60
-
61
- it "should have a consumer" do
62
- expect(loaded_pact.consumer).to be_instance_of Pact::ServiceConsumer
63
- end
64
-
65
- it "should have a provider" do
66
- expect(loaded_pact.provider).to be_instance_of Pact::ServiceProvider
67
- expect(loaded_pact.provider.name).to eq "an old producer"
68
- end
69
-
70
- it "should have a provider_state" do
71
- expect(loaded_pact.interactions.first.provider_state).to eq 'state one'
72
- end
73
- end
74
- end
75
- end
76
-
77
- describe "find_interactions" do
78
- let(:consumer) { double('Pact::ServiceConsumer', :name => 'Consumer')}
79
- let(:provider) { double('Pact::ServiceProvider', :name => 'Provider')}
80
- let(:interaction) { double('Pact::Interaction') }
81
- subject { ConsumerContract.new(:interactions => [interaction], :consumer => consumer, :provider => provider) }
82
- let(:criteria) { {:description => /blah/} }
83
- before do
84
- expect(interaction).to receive(:matches_criteria?).with(criteria).and_return(matches)
85
- end
86
- context "by description" do
87
- context "when no interactions are found" do
88
- let(:matches) { false }
89
- it "returns an empty array" do
90
- expect(subject.find_interactions(criteria)).to eql []
91
- end
92
- end
93
- context "when interactions are found" do
94
- let(:matches) { true }
95
- it "returns an array of the matching interactions" do
96
- expect(subject.find_interactions(criteria)).to eql [interaction]
97
- end
98
- end
99
- end
100
- end
101
-
102
- describe "find_interaction" do
103
- let(:consumer) { double('Pact::ServiceConsumer', :name => 'Consumer')}
104
- let(:provider) { double('Pact::ServiceProvider', :name => 'Provider')}
105
- let(:interaction1) { double('Pact::Interaction') }
106
- let(:interaction2) { double('Pact::Interaction') }
107
- let(:criteria) { {:description => /blah/} }
108
-
109
- before do
110
- expect(interaction1).to receive(:matches_criteria?).with(criteria).and_return(matches1)
111
- expect(interaction2).to receive(:matches_criteria?).with(criteria).and_return(matches2)
112
- end
113
-
114
- subject { ConsumerContract.new(:interactions => [interaction1, interaction2], :consumer => consumer, :provider => provider) }
115
- context "by description" do
116
- context "when a match is found" do
117
- let(:matches1) { true }
118
- let(:matches2) { false }
119
-
120
- it "returns the interaction" do
121
- expect(subject.find_interaction criteria).to eql interaction1
122
- end
123
- end
124
- context "when more than one match is found" do
125
- let(:matches1) { true }
126
- let(:matches2) { true }
127
- it "raises an error" do
128
- expect{ subject.find_interaction(criteria) }.to raise_error "Found more than 1 interaction matching {:description=>/blah/} in pact file between Consumer and Provider."
129
- end
130
- end
131
- context "when a match is not found" do
132
- let(:matches1) { false }
133
- let(:matches2) { false }
134
- it "raises an error" do
135
- expect{ subject.find_interaction(criteria) }.to raise_error "Could not find interaction matching {:description=>/blah/} in pact file between Consumer and Provider."
136
- end
137
- end
138
- end
139
- end
140
-
141
- end
142
- end
@@ -1,24 +0,0 @@
1
- require 'pact/consumer_contract/file_name'
2
-
3
- module Pact
4
- describe FileName do
5
- describe "file_path" do
6
-
7
- subject { FileName.file_path 'foo', 'bar', 'tmp/pacts' }
8
- it { is_expected.to eq 'tmp/pacts/foo-bar.json' }
9
-
10
- context "when unique is true" do
11
- subject { FileName.file_path 'foo', 'bar', 'tmp/pacts', unique: true }
12
- it { is_expected.to match %r{tmp/pacts/foo-bar-\d+.json} }
13
- end
14
-
15
- context "when the path includes backslashes" do
16
- subject { FileName.file_path 'foo', 'bar', 'c:\tmp\pacts' }
17
-
18
- it "changes them to forward slashes" do
19
- expect(subject).to eq "c:/tmp/pacts/foo-bar.json"
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,107 +0,0 @@
1
- require 'spec_helper'
2
- require 'pact/consumer_contract/headers'
3
-
4
- module Pact
5
- describe Headers do
6
-
7
- describe "initialize" do
8
-
9
- context "with duplicate headers" do
10
-
11
- subject { Headers.new('Content-Type' => 'application/hippo', 'CONTENT-TYPE' => 'application/giraffe') }
12
-
13
- it "raises an error" do
14
- expect { subject }.to raise_error DuplicateHeaderError, /Content\-Type.*CONTENT\-TYPE/
15
- end
16
-
17
- end
18
-
19
- context "with a symbol as a header name" do
20
-
21
- subject { Headers.new(:'content-type' => 'application/hippo') }
22
-
23
- it "converts the header name to a String" do
24
- expect( subject.to_hash ).to eq 'content-type' => 'application/hippo'
25
- end
26
-
27
- end
28
-
29
- context "with a nil header name" do
30
-
31
- subject { Headers.new(nil => 'application/hippo') }
32
-
33
- it "raises an error" do
34
- expect{ subject }.to raise_error InvalidHeaderNameTypeError
35
- end
36
-
37
- end
38
-
39
- context "with a boolean header name" do
40
-
41
- subject { Headers.new(false => 'application/hippo') }
42
-
43
- it "raises an error" do
44
- expect{ subject }.to raise_error InvalidHeaderNameTypeError
45
- end
46
-
47
- end
48
-
49
- end
50
-
51
- describe "[]" do
52
-
53
- subject { Headers.new 'Content-Type' => 'application/hippo' }
54
-
55
- it "is case insensitive as HTTP headers are case insensitive" do
56
- expect(subject['Content-Type']).to eq('application/hippo')
57
- expect(subject['CONTENT-TYPE']).to eq('application/hippo')
58
- expect(subject['content-type']).to eq('application/hippo')
59
- end
60
-
61
- end
62
-
63
- describe "fetch" do
64
-
65
- subject { Headers.new 'Content-Type' => 'application/hippo' }
66
-
67
- it "is case insensitive as HTTP headers are case insensitive" do
68
- expect(subject.fetch('Content-Type')).to eq('application/hippo')
69
- expect(subject.fetch('CONTENT-TYPE')).to eq('application/hippo')
70
- expect(subject.fetch('content-type')).to eq('application/hippo')
71
- expect(subject.fetch('Content-Length','1')).to eq('1')
72
- expect { subject.fetch('Content-Length')}.to raise_error KeyError
73
- end
74
-
75
- end
76
-
77
- describe "key?" do
78
-
79
- subject { Headers.new 'Content-Type' => 'application/hippo' }
80
-
81
- it "is case insensitive as HTTP headers are case insensitive" do
82
- expect(subject.key?('CONTENT-TYPE')).to be true
83
- expect(subject.key?('CONTENT-LENGTH')).to be false
84
- end
85
- end
86
-
87
- describe "has_key?" do
88
-
89
- subject { Headers.new 'Content-Type' => 'application/hippo' }
90
-
91
- it "is case insensitive as HTTP headers are case insensitive" do
92
- expect(subject.has_key?('CONTENT-TYPE')).to be true
93
- expect(subject.has_key?('CONTENT-LENGTH')).to be false
94
- end
95
- end
96
-
97
- describe "[]=" do
98
-
99
- subject { Headers.new }
100
-
101
- it "does not allow modification" do
102
- expect{ subject['Content-Type'] = 'application/hippo' }.to raise_error /frozen/
103
- end
104
-
105
- end
106
- end
107
- end
@@ -1,25 +0,0 @@
1
- require 'pact/consumer_contract/http_consumer_contract_parser'
2
-
3
- module Pact
4
- describe HttpConsumerContractParser do
5
- describe "#call integration test" do
6
- subject { HttpConsumerContractParser.new.call(pact_hash) }
7
-
8
- context "with a v2 pact" do
9
- let(:pact_hash) { load_json_fixture('pact-http-v2.json') }
10
-
11
- it "correctly parses the pact" do
12
- expect(subject.interactions.first.response.headers['Content-Type']).to be_a(Pact::Term)
13
- end
14
- end
15
-
16
- context "with a v3 pact" do
17
- let(:pact_hash) { load_json_fixture('pact-http-v3.json') }
18
-
19
- it "correctly parses the pact" do
20
- expect(subject.interactions.first.response.body['foo']).to be_a(Pact::SomethingLike)
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,62 +0,0 @@
1
- require 'pact/consumer_contract/interaction_parser'
2
-
3
- module Pact
4
- describe InteractionParser do
5
- describe ".call" do
6
-
7
- let(:request) { {method: 'get', path: 'path'} }
8
- let(:response) { {} }
9
-
10
- context "when providerState has been used instead of provider_state" do
11
-
12
- subject { InteractionParser.call('response' => response, 'request' => request, 'providerState' => 'some state') }
13
-
14
- it "recognises the provider state" do
15
- expect(subject.provider_state).to eq 'some state'
16
- end
17
- end
18
-
19
- context "when there are matching rules" do
20
- let(:hash) { load_json_fixture 'interaction-with-matching-rules.json' }
21
-
22
- subject { InteractionParser.call(hash, pact_specification_version: Pact::SpecificationVersion.new("2")) }
23
-
24
- it "merges the rules with the example for the request" do
25
- expect(subject.request.body['name']).to be_instance_of(Pact::Term)
26
- end
27
-
28
- it "merges the rules with the example for the response" do
29
- expect(subject.response.body['_links']['self']['href']).to be_instance_of(Pact::Term)
30
- end
31
- end
32
-
33
- context "when the request body is a String" do
34
- let(:hash) { { 'request' => request, 'response' => response } }
35
- subject { InteractionParser.call(hash, pact_specification_version: Pact::SpecificationVersion.new("3")) }
36
-
37
- let(:request) { { 'method' => 'get', 'path' => 'path' , 'body' => "<xml></xml>", 'matchingRules' => {"body" => {"foo" => "bar"} } } }
38
-
39
- it "returns an interaction with an StringWithMatchingRules in the request" do
40
- expect(subject.request.body).to be_a(Pact::StringWithMatchingRules)
41
- expect(subject.request.body).to eq "<xml></xml>"
42
- expect(subject.request.body.matching_rules).to eq "foo" => "bar"
43
- expect(subject.request.body.pact_specification_version).to eq Pact::SpecificationVersion.new("3")
44
- end
45
- end
46
-
47
- context "when the response body is a String" do
48
- let(:hash) { { 'request' => request, 'response' => response } }
49
- subject { InteractionParser.call(hash, pact_specification_version: Pact::SpecificationVersion.new("3")) }
50
-
51
- let(:response) { { 'status' => '200', 'body' => "<xml></xml>", 'matchingRules' => {"body" => {"foo" => "bar"} } } }
52
-
53
- it "returns an interaction with an StringWithMatchingRules in the response" do
54
- expect(subject.response.body).to be_a(Pact::StringWithMatchingRules)
55
- expect(subject.response.body).to eq "<xml></xml>"
56
- expect(subject.response.body.matching_rules).to eq "foo" => "bar"
57
- expect(subject.response.body.pact_specification_version).to eq Pact::SpecificationVersion.new("3")
58
- end
59
- end
60
- end
61
- end
62
- end
@@ -1,121 +0,0 @@
1
- require 'spec_helper'
2
- require 'pact/reification'
3
- require 'pact/consumer_contract/interaction'
4
-
5
- module Pact
6
- module Consumer
7
-
8
- describe Interaction do
9
-
10
- let(:request) { {method: 'get', path: 'path'} }
11
- let(:response) { {} }
12
-
13
- describe "==" do
14
- subject { InteractionFactory.create }
15
- context "when other is the same" do
16
- let(:other) { InteractionFactory.create }
17
- it "returns true" do
18
- expect(subject == other).to be true
19
- end
20
- end
21
- context "when other is not the same" do
22
- let(:other) { InteractionFactory.create(:request => {:path => '/a_different_path'}) }
23
- it "returns false" do
24
- expect(subject == other).to be false
25
- end
26
- end
27
- context "with a SomethingLike" do
28
- let(:response) { {body: {age: SomethingLike.new(20)} } }
29
- let(:other_response) { {body: {age: SomethingLike.new(20)} } }
30
- let(:other) { InteractionFactory.create(response: other_response) }
31
- subject { InteractionFactory.create response: response }
32
-
33
- it "returns true" do
34
- expect(subject == other).to be true
35
- end
36
- end
37
- end
38
-
39
- describe "matches_criteria?" do
40
- subject { InteractionFactory.create(:description => 'a request for food') }
41
-
42
- context "by description" do
43
- context "when the interaction matches" do
44
- it "returns true" do
45
- expect(subject.matches_criteria?(:description => /request.*food/)).to be true
46
- end
47
- end
48
-
49
- context "when the interaction does not match" do
50
- it "returns false" do
51
- expect(subject.matches_criteria?(:description => /blah/)).to be false
52
- end
53
- end
54
- end
55
- end
56
-
57
- describe "request_modifies_resource_without_checking_response_body?" do
58
- let(:interaction) { Interaction.new(request: request, response: response)}
59
-
60
- subject { interaction.request_modifies_resource_without_checking_response_body?}
61
-
62
- context "when the request modifies the resource and the response allows any value in body" do
63
- let(:request) { instance_double(Pact::Request::Expected, modifies_resource?: true) }
64
- let(:response) { instance_double(Pact::Response, body_allows_any_value?: true) }
65
-
66
- it "returns true" do
67
- expect(subject).to be true
68
- end
69
- end
70
-
71
- context "when the request modifies the resource and the response does not allow any value in body" do
72
- let(:request) { instance_double(Pact::Request::Expected, modifies_resource?: true) }
73
- let(:response) { instance_double(Pact::Response, body_allows_any_value?: false) }
74
-
75
- it "returns false" do
76
- expect(subject).to be false
77
- end
78
- end
79
-
80
- context "when the request does not modifies the resource and the response does not allow any value in body" do
81
- let(:request) { instance_double(Pact::Request::Expected, modifies_resource?: false) }
82
- let(:response) { instance_double(Pact::Response, body_allows_any_value?: false) }
83
-
84
- it "returns false" do
85
- expect(subject).to be false
86
- end
87
- end
88
-
89
- context "when the request does not modifies the resource and the response allows any value in body" do
90
- let(:request) { instance_double(Pact::Request::Expected, modifies_resource?: false) }
91
- let(:response) { instance_double(Pact::Response, body_allows_any_value?: true) }
92
-
93
- it "returns false" do
94
- expect(subject).to be false
95
- end
96
- end
97
- end
98
-
99
- describe "#validate!" do
100
- let(:interaction) { InteractionFactory.create }
101
-
102
- context "when it lacks necessary data" do
103
- before { interaction.description = nil }
104
-
105
- it "raises Pact::InvalidInteractionError" do
106
- expect { interaction.validate! }.to(raise_error(Pact::InvalidInteractionError) do |e|
107
- expect(e.message).to include("description")
108
- expect(e.message).not_to include("request")
109
- end)
110
- end
111
- end
112
-
113
- context "when it has all necessary data" do
114
- it "does not raise any errors" do
115
- expect { interaction.validate! }.not_to raise_error
116
- end
117
- end
118
- end
119
- end
120
- end
121
- end