pact-support 1.11.0 → 1.12.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 (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/lib/pact/consumer_contract/consumer_contract.rb +11 -0
  4. data/lib/pact/consumer_contract/interaction.rb +4 -1
  5. data/lib/pact/consumer_contract/interaction_v2_parser.rb +9 -1
  6. data/lib/pact/consumer_contract/interaction_v3_parser.rb +10 -1
  7. data/lib/pact/support/version.rb +1 -1
  8. metadata +4 -227
  9. data/.github/ISSUE_TEMPLATE.md +0 -33
  10. data/.gitignore +0 -32
  11. data/.rspec +0 -3
  12. data/.travis.yml +0 -29
  13. data/Appraisals +0 -7
  14. data/Gemfile +0 -4
  15. data/RELEASING.md +0 -5
  16. data/Rakefile +0 -4
  17. data/gemfiles/default.gemfile +0 -5
  18. data/gemfiles/ruby_under_22.gemfile +0 -8
  19. data/pact-support.gemspec +0 -39
  20. data/script/release.sh +0 -9
  21. data/script/update-pact-specification-v2 +0 -9
  22. data/spec/fixtures/interaction-with-matching-rules.json +0 -27
  23. data/spec/fixtures/multipart-form-diff.txt +0 -9
  24. data/spec/fixtures/not-a-pact.json +0 -3
  25. data/spec/fixtures/pact-http-v2.json +0 -36
  26. data/spec/fixtures/pact-http-v3.json +0 -36
  27. data/spec/integration/matching_rules_extract_and_merge_spec.rb +0 -127
  28. data/spec/lib/pact/array_like_spec.rb +0 -37
  29. data/spec/lib/pact/configuration_spec.rb +0 -61
  30. data/spec/lib/pact/consumer/request_spec.rb +0 -25
  31. data/spec/lib/pact/consumer_contract/active_support_support_spec.rb +0 -58
  32. data/spec/lib/pact/consumer_contract/consumer_contract_spec.rb +0 -142
  33. data/spec/lib/pact/consumer_contract/file_name_spec.rb +0 -24
  34. data/spec/lib/pact/consumer_contract/headers_spec.rb +0 -107
  35. data/spec/lib/pact/consumer_contract/http_consumer_contract_parser_spec.rb +0 -25
  36. data/spec/lib/pact/consumer_contract/interaction_parser_spec.rb +0 -62
  37. data/spec/lib/pact/consumer_contract/interaction_spec.rb +0 -121
  38. data/spec/lib/pact/consumer_contract/interaction_v2_parser_spec.rb +0 -54
  39. data/spec/lib/pact/consumer_contract/interaction_v3_parser_spec.rb +0 -48
  40. data/spec/lib/pact/consumer_contract/pact_file_spec.rb +0 -204
  41. data/spec/lib/pact/consumer_contract/query_hash_spec.rb +0 -154
  42. data/spec/lib/pact/consumer_contract/query_string_spec.rb +0 -131
  43. data/spec/lib/pact/consumer_contract/request_spec.rb +0 -486
  44. data/spec/lib/pact/consumer_contract/response_spec.rb +0 -82
  45. data/spec/lib/pact/helpers_spec.rb +0 -143
  46. data/spec/lib/pact/matchers/differ_spec.rb +0 -215
  47. data/spec/lib/pact/matchers/difference_spec.rb +0 -22
  48. data/spec/lib/pact/matchers/embedded_diff_formatter_spec.rb +0 -90
  49. data/spec/lib/pact/matchers/extract_diff_messages_spec.rb +0 -78
  50. data/spec/lib/pact/matchers/index_not_found_spec.rb +0 -21
  51. data/spec/lib/pact/matchers/list_diff_formatter_spec.rb +0 -121
  52. data/spec/lib/pact/matchers/matchers_array_like_spec.rb +0 -222
  53. data/spec/lib/pact/matchers/matchers_messages_hash_and_array_spec.rb +0 -146
  54. data/spec/lib/pact/matchers/matchers_messages_mismatched_value_spec.rb +0 -72
  55. data/spec/lib/pact/matchers/matchers_messages_regexp_spec.rb +0 -103
  56. data/spec/lib/pact/matchers/matchers_spec.rb +0 -561
  57. data/spec/lib/pact/matchers/multipart_form_diff_formatter_spec.rb +0 -36
  58. data/spec/lib/pact/matchers/no_diff_at_index_spec.rb +0 -15
  59. data/spec/lib/pact/matchers/regexp_difference_spec.rb +0 -20
  60. data/spec/lib/pact/matchers/type_difference_spec.rb +0 -36
  61. data/spec/lib/pact/matchers/unexpected_index_spec.rb +0 -20
  62. data/spec/lib/pact/matchers/unexpected_key_spec.rb +0 -20
  63. data/spec/lib/pact/matchers/unix_diff_formatter_spec.rb +0 -235
  64. data/spec/lib/pact/matching_rules/extract_spec.rb +0 -216
  65. data/spec/lib/pact/matching_rules/merge_spec.rb +0 -436
  66. data/spec/lib/pact/matching_rules/v3/extract_spec.rb +0 -238
  67. data/spec/lib/pact/matching_rules/v3/merge_spec.rb +0 -485
  68. data/spec/lib/pact/matching_rules_spec.rb +0 -82
  69. data/spec/lib/pact/reification_spec.rb +0 -172
  70. data/spec/lib/pact/shared/dsl_spec.rb +0 -100
  71. data/spec/lib/pact/shared/form_differ_spec.rb +0 -71
  72. data/spec/lib/pact/shared/json_differ_spec.rb +0 -36
  73. data/spec/lib/pact/shared/key_not_found_spec.rb +0 -20
  74. data/spec/lib/pact/shared/multipart_form_differ_spec.rb +0 -49
  75. data/spec/lib/pact/shared/request_spec.rb +0 -235
  76. data/spec/lib/pact/shared/text_differ_spec.rb +0 -54
  77. data/spec/lib/pact/something_like_spec.rb +0 -23
  78. data/spec/lib/pact/support_spec.rb +0 -9
  79. data/spec/lib/pact/symbolize_keys_spec.rb +0 -15
  80. data/spec/lib/pact/term_spec.rb +0 -89
  81. data/spec/pact_specification/compliance-2.0.rb +0 -66
  82. data/spec/spec_helper.rb +0 -18
  83. data/spec/support/a_consumer-a_producer.json +0 -32
  84. data/spec/support/a_consumer-a_provider.json +0 -32
  85. data/spec/support/active_support_if_configured.rb +0 -6
  86. data/spec/support/case-insensitive-response-header-matching.json +0 -21
  87. data/spec/support/consumer_contract_template.json +0 -24
  88. data/spec/support/dsl_spec_support.rb +0 -7
  89. data/spec/support/factories.rb +0 -87
  90. data/spec/support/generated_index.md +0 -4
  91. data/spec/support/generated_markdown.md +0 -55
  92. data/spec/support/interaction_view_model.json +0 -63
  93. data/spec/support/interaction_view_model_with_terms.json +0 -50
  94. data/spec/support/markdown_pact.json +0 -48
  95. data/spec/support/missing_provider_states_output.txt +0 -25
  96. data/spec/support/options.json +0 -21
  97. data/spec/support/ruby_version_helpers.rb +0 -23
  98. data/spec/support/shared_examples_for_request.rb +0 -132
  99. data/spec/support/spec_support.rb +0 -29
  100. data/spec/support/stubbing.json +0 -22
  101. data/spec/support/term.json +0 -48
  102. data/spec/support/test_app_fail.json +0 -61
  103. data/spec/support/test_app_pass.json +0 -38
  104. data/spec/support/test_app_with_right_content_type_differ.json +0 -23
  105. data/tasks/release.rake +0 -5
  106. data/tasks/spec.rake +0 -14
@@ -1,82 +0,0 @@
1
- require 'pact/matching_rules'
2
-
3
- module Pact
4
- module MatchingRules
5
- describe ".merge" do
6
- before do
7
- allow(V3::Merge).to receive(:call)
8
- allow(Merge).to receive(:call)
9
- allow(Pact.configuration.error_stream).to receive(:puts)
10
- end
11
-
12
- let(:object) { double('object') }
13
- let(:rules) { double('rules') }
14
- let(:options) { { pact_specification_version: Pact::SpecificationVersion.new(pact_specification_version) } }
15
-
16
- subject { MatchingRules.merge(object, rules, options)}
17
-
18
- context "when the pact_specification_version is nil" do
19
- let(:options) { { pact_specification_version: nil } }
20
-
21
- it "calls Merge" do
22
- expect(Merge).to receive(:call)
23
- subject
24
- end
25
- end
26
-
27
- context "when the pact_specification_version starts with '1.'" do
28
- let(:pact_specification_version) { "1.0" }
29
-
30
- it "calls Merge" do
31
- expect(Merge).to receive(:call)
32
- subject
33
- end
34
- end
35
-
36
- context "when the pact_specification_version is with '1'" do
37
- let(:pact_specification_version) { "1" }
38
-
39
- it "calls Merge" do
40
- expect(Merge).to receive(:call)
41
- subject
42
- end
43
- end
44
-
45
- context "when the pact_specification_version starts with '2.'" do
46
- let(:pact_specification_version) { "2.0" }
47
-
48
- it "calls Merge" do
49
- expect(Merge).to receive(:call)
50
- subject
51
- end
52
- end
53
-
54
- context "when the pact_specification_version starts with '3.'" do
55
- let(:pact_specification_version) { "3.0" }
56
-
57
- it "calls V3::Merge" do
58
- expect(V3::Merge).to receive(:call)
59
- subject
60
- end
61
- end
62
-
63
- context "when the pact_specification_version starts with '4.'" do
64
- let(:pact_specification_version) { "4.0" }
65
-
66
- it "calls V3::Merge" do
67
- expect(V3::Merge).to receive(:call)
68
- subject
69
- end
70
- end
71
-
72
- context "when the pact_specification_version is with '11'" do
73
- let(:pact_specification_version) { "11" }
74
-
75
- it "calls V3::Merge" do
76
- expect(V3::Merge).to receive(:call)
77
- subject
78
- end
79
- end
80
- end
81
- end
82
- end
@@ -1,172 +0,0 @@
1
- require 'spec_helper'
2
- require 'pact/reification'
3
- require 'pact/consumer_contract/request'
4
-
5
- module Pact
6
- describe Reification do
7
-
8
- let(:response_spec) do
9
- {
10
- woot: /x/,
11
- britney: 'britney',
12
- nested: { foo: /bar/, baz: 'qux' },
13
- my_term: Term.new(generate: 'wiffle', matcher: /^wif/),
14
- array: ['first', /second/]
15
- }
16
- end
17
-
18
- describe "from term" do
19
-
20
- subject { Reification.from_term(response_spec) }
21
-
22
- it "converts regexes into real data" do
23
- expect(subject[:woot]).to eql 'x'
24
- end
25
-
26
- it "converts terms into real data" do
27
- expect(subject[:my_term]).to eql 'wiffle'
28
- end
29
-
30
- it "passes strings through" do
31
- expect(subject[:britney]).to eql 'britney'
32
- end
33
-
34
- it "handles nested hashes" do
35
- expect(subject[:nested]).to eql({ foo: 'bar', baz: 'qux' })
36
- end
37
-
38
- it "handles arrays" do
39
- expect(subject[:array]).to eql ['first', 'second']
40
- end
41
-
42
- end
43
-
44
- context "when reifying a Request" do
45
-
46
- let(:request){ Pact::Request::Expected.from_hash(method: 'get', path: '/', body: Pact::Term.new(generate: "sunny", matcher: /sun/))}
47
-
48
- subject { Reification.from_term(request) }
49
-
50
- it "turns it into a hash before reifying it" do
51
- expect(subject[:body]).to eq("sunny")
52
- end
53
-
54
- end
55
-
56
- context "when SomethingLike" do
57
-
58
- let(:request) { Pact::SomethingLike.new({a: 'String'})}
59
-
60
- subject { Reification.from_term(request)}
61
-
62
- it "returns the contents of the SomethingLike" do
63
- expect(subject).to eq({a: 'String'})
64
- end
65
-
66
- end
67
-
68
- context "when nested SomethingLike" do
69
-
70
- let(:request) {
71
- Pact::SomethingLike.new(
72
- {
73
- a: 'String',
74
- b: Pact::SomethingLike.new(
75
- c: 'NestedString'
76
- )
77
- }
78
- )
79
- }
80
-
81
- subject { Reification.from_term(request)}
82
-
83
- it "returns the contents of the SomethingLike" do
84
- expect(subject).to eq({a: 'String', b: { c: 'NestedString' }})
85
- end
86
-
87
- end
88
-
89
- context "when ArrayLike" do
90
-
91
- let(:request) { Pact::ArrayLike.new({a: 'String'}, {min: 3})}
92
-
93
- subject { Reification.from_term(request)}
94
-
95
- it "returns the contents of the ArrayLike" do
96
- expect(subject).to eq([{a: 'String'}, {a: 'String'}, {a: 'String'}])
97
- end
98
-
99
- end
100
-
101
- context "when Query" do
102
-
103
- let(:query) { QueryString.new(Pact::Term.new(generate: "param=thing", matcher: /param=.*/)) }
104
-
105
- subject { Reification.from_term(query)}
106
-
107
- it "returns the contents of the generate" do
108
- expect(subject).to eq("param=thing")
109
- end
110
-
111
- end
112
-
113
- context "when Hash Query" do
114
-
115
- subject { Reification.from_term(query)}
116
-
117
- let(:query) { QueryHash.new( {param: 'hello', extra: 'world'})}
118
-
119
- it "returns the hash in the natural order" do
120
- expect(subject).to eq("param=hello&extra=world")
121
- end
122
- end
123
-
124
- context "when Hash Query with UTF-8 string" do
125
- subject { Reification.from_term(query)}
126
-
127
- let(:query) { QueryHash.new(param: 'ILove', extra: '寿司') }
128
-
129
- it "returns the hash with escaping UTF-8 string" do
130
- expect(subject).to eq("param=ILove&extra=%E5%AF%BF%E5%8F%B8")
131
- end
132
- end
133
-
134
- context "when Hash Query with embeded terms" do
135
- subject { Reification.from_term(query)}
136
-
137
- let(:query) { QueryHash.new( {param: 'hello', extra: Pact::Term.new(generate: "wonderworld", matcher: /\w+world/)})}
138
-
139
- it "returns the hash in the natural order, and fills in Terms appropriately" do
140
- expect(subject).to eq("param=hello&extra=wonderworld")
141
- end
142
- end
143
-
144
- context "when Hash Query with Arrays and multiple params with the same name" do
145
- subject { Reification.from_term(query)}
146
-
147
- let(:query) { QueryHash.new( {param: 'hello', double: [Pact::Term.new(generate: "wonder", matcher: /\w+/), 'world'], simple: 'bye'})}
148
-
149
- it "returns the hash in the natural order, and fills in Terms appropriately" do
150
- expect(subject).to eq("param=hello&double=wonder&double=world&simple=bye")
151
- end
152
- end
153
-
154
- context "when Hash Query with an ArrayLike" do
155
- subject { Reification.from_term(query)}
156
-
157
- let(:query) { QueryHash.new(param: Pact.each_like("1", min: 2)) }
158
-
159
- it "turns the hash into a string with the right number of params" do
160
- expect(subject).to eq("param=1&param=1")
161
- end
162
- end
163
-
164
- context "with a StringWithMatchingRules" do
165
- subject { Reification.from_term(StringWithMatchingRules.new("foo", Pact::SpecificationVersion.new("3"), {}))}
166
-
167
- it "returns a String" do
168
- expect(subject.class).to be String
169
- end
170
- end
171
- end
172
- end
@@ -1,100 +0,0 @@
1
- require 'spec_helper'
2
- require 'pact/shared/dsl'
3
- require 'support/dsl_spec_support'
4
-
5
- module Pact
6
- describe DSL do
7
-
8
- class TestDSL
9
- extend DSL
10
- attr_accessor :thing, :blah, :global, :the_block, :another_block, :finalized
11
-
12
- def initialize
13
- @thing = 0
14
- end
15
-
16
- dsl do
17
- def with_thing thing
18
- self.thing = thing
19
- end
20
- def with_blah blah
21
- self.blah = blah
22
- end
23
- def with_global global
24
- self.global = global
25
- end
26
-
27
- def with_block &the_block
28
- self.the_block = the_block
29
- end
30
-
31
- def with_another_block &the_block
32
- self.another_block = the_block
33
- end
34
-
35
- end
36
-
37
- def finalize
38
- @finalized = true
39
- end
40
- end
41
-
42
- describe "build" do
43
- context "with block" do
44
- before do
45
- def my_local_method
46
- 'LA LA LA'
47
- end
48
-
49
- my_local_var = 123
50
-
51
- local_app = "I'm a local app"
52
-
53
- @test = TestDSL.build do
54
- with_thing my_local_method
55
- with_blah my_local_var
56
- with_global global_method
57
- with_block do
58
- global_app
59
- end
60
- with_another_block do
61
- local_app
62
- end
63
- end
64
- end
65
-
66
- it "supports using a local variable" do
67
- expect(@test.blah).to eq 123
68
- end
69
-
70
- it "supports using a local method" do
71
- expect(@test.thing).to eq 'LA LA LA'
72
- end
73
-
74
- it "supports using global methods from other files" do
75
- expect(@test.global).to eq "I'm global"
76
- end
77
-
78
- it "supports using a local method to provide the app" do
79
- expect(@test.another_block.call).to eq("I'm a local app")
80
- end
81
-
82
- it "should support using a global method to provide the app but it doesn't" do
83
- expect(@test.the_block.call).to eq("I'm a global app")
84
- end
85
-
86
- it "calls finalize" do
87
- expect(@test.finalized).to be true
88
- end
89
- end
90
-
91
- context "without block" do
92
- let(:test) { TestDSL.build }
93
-
94
- it "initializes an instance" do
95
- expect(test.thing).to eq(0)
96
- end
97
- end
98
- end
99
- end
100
- end
@@ -1,71 +0,0 @@
1
- require 'spec_helper'
2
- require 'pact/shared/form_differ'
3
- require 'pact/matchers/difference'
4
- require 'pact/matchers/unix_diff_formatter'
5
-
6
- module Pact
7
- describe FormDiffer do
8
-
9
- describe ".call" do
10
-
11
- let(:expected) { "param1=foo&param2=bar&param2=foobar" }
12
- let(:actual) { "param1=wiffle&param2=foobar&param2=bar" }
13
-
14
- let(:difference) do
15
- {
16
- 'param1' => [Pact::Matchers::Difference.new("foo", "wiffle")],
17
- 'param2' => [Pact::Matchers::Difference.new("bar", "foobar"), Pact::Matchers::Difference.new("foobar", "bar")]
18
- }
19
- end
20
-
21
- subject { FormDiffer.call(expected, actual) }
22
-
23
- context "when there is a diff" do
24
- it "returns the diff" do
25
- expect(subject).to eq difference
26
- end
27
- end
28
-
29
- context "when the expected is a matching Hash" do
30
- let(:expected) do
31
- {
32
- param1: "wiffle",
33
- param2: ["foobar", "bar"]
34
- }
35
- end
36
-
37
- it "returns an empty diff" do
38
- expect(subject).to be_empty
39
- end
40
- end
41
-
42
- context "when the expected is a matching Hash with a Pact::Term" do
43
- let(:expected) do
44
- {
45
- param1: "wiffle",
46
- param2: [Pact::Term.new(generate: 'foobar', matcher: /bar/), "bar"]
47
- }
48
- end
49
-
50
- it "returns an empty diff" do
51
- expect(subject).to be_empty
52
- end
53
- end
54
-
55
- context "when the expected is a Hash that doesn't match the actual" do
56
- let(:expected) do
57
- {
58
- param1: "woffle",
59
- param2: ["foobar", "bar"]
60
- }
61
- end
62
-
63
- it "returns the diff" do
64
- expect(subject).to_not be_empty
65
- end
66
- end
67
-
68
- end
69
-
70
- end
71
- end
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
- require 'pact/shared/json_differ'
3
-
4
- module Pact
5
- describe JsonDiffer do
6
-
7
- describe ".call" do
8
-
9
- let(:expected) { {'a' => 'b'} }
10
-
11
- subject { JsonDiffer.call(expected, actual) }
12
-
13
- context "when the actual is valid JSON" do
14
-
15
- let(:actual) { {'a' => 'c'} }
16
- let(:difference) { {'a' => Pact::Matchers::Difference.new('b', 'c')} }
17
-
18
- context "when the actual does not equal the expected" do
19
- it "parses the JSON and returns a diff" do
20
- expect(subject).to eq(difference)
21
- end
22
- end
23
-
24
- context "when the actual equals the expected" do
25
- let(:actual) { expected }
26
- it "parses the JSON and returns an empty diff" do
27
- expect(subject.any?).to be false
28
- end
29
- end
30
-
31
- end
32
-
33
- end
34
-
35
- end
36
- end