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,48 +0,0 @@
1
- {
2
- "provider": {
3
- "name": "Some Provider"
4
- },
5
- "consumer": {
6
- "name": "Some Consumer"
7
- },
8
- "interactions": [
9
- {
10
- "description": "a request for alligators",
11
- "provider_state": "alligators exist",
12
- "request": {
13
- "method": "get",
14
- "path": "/alligators"
15
- },
16
- "response": {
17
- "headers" : {"Content-Type": "application/json"},
18
- "status" : 200,
19
- "body" : {
20
- "alligators": [{
21
- "name": "Bob",
22
- "phoneNumber" : {
23
- "json_class": "Pact::Term",
24
- "data": {
25
- "generate": "12345678",
26
- "matcher": {"json_class":"Regexp","o":0,"s":"\\d+"}
27
- }
28
- }
29
- }]
30
- }
31
- }
32
- },{
33
- "description": "a request for polar bears",
34
- "provider_state": null,
35
- "request": {
36
- "method": "get",
37
- "path": "/polar-bears"
38
- },
39
- "response": {
40
- "headers" : {"Content-Type": "application/json"},
41
- "status" : 404,
42
- "body" : {
43
- "message": "Sorry, due to climate change, the polar bears are currently unavailable."
44
- }
45
- }
46
- }
47
- ]
48
- }
@@ -1,25 +0,0 @@
1
- Pact.provider_states_for "Consumer 1" do
2
-
3
- provider_state "state1" do
4
- set_up do
5
- # Your set up code goes here
6
- end
7
- end
8
-
9
- provider_state "state2" do
10
- set_up do
11
- # Your set up code goes here
12
- end
13
- end
14
-
15
- end
16
-
17
- Pact.provider_states_for "Consumer 2" do
18
-
19
- provider_state "state3" do
20
- set_up do
21
- # Your set up code goes here
22
- end
23
- end
24
-
25
- end
@@ -1,21 +0,0 @@
1
- {
2
- "consumer": {
3
- "name": "Consumer"
4
- },
5
- "provider": {
6
- "name": "Provider"
7
- },
8
- "interactions": [
9
- {
10
- "description": "an OPTIONS request",
11
- "request": {
12
- "method": "options",
13
- "path": "/"
14
- },
15
- "response": {
16
- "status": 200
17
- },
18
- "provider_state": null
19
- }
20
- ]
21
- }
@@ -1,23 +0,0 @@
1
- module RubyVersionHelpers
2
- RUBY_2_4 = Gem::Version.new('2.4.0')
3
- CURRENT_RUBY = Gem::Version.new(RUBY_VERSION)
4
-
5
- def numeric_type
6
- if CURRENT_RUBY < RUBY_2_4
7
- Fixnum
8
- else
9
- Integer
10
- end
11
- end
12
- module_function :numeric_type
13
-
14
- def a_numeric
15
- type = numeric_type
16
- if type == Integer
17
- "an #{type}"
18
- else
19
- "a #{type}"
20
- end
21
- end
22
- module_function :a_numeric
23
- end
@@ -1,132 +0,0 @@
1
- shared_examples "a request" do
2
-
3
- describe 'matching' do
4
- let(:expected) do
5
- Pact::Request::Expected.from_hash(
6
- {'method' => 'get', 'path' => 'path', 'query' => /b/}
7
- )
8
- end
9
-
10
- let(:actual) do
11
- Pact::Consumer::Request::Actual.from_hash({'method' => 'get', 'path' => 'path', 'query' => 'blah', 'headers' => {}, 'body' => ''})
12
- end
13
-
14
- it "should match" do
15
- expect(expected.difference(actual)).to eq({})
16
- end
17
- end
18
-
19
- describe 'full_path' do
20
- context "with empty path" do
21
- subject { described_class.from_hash({:path => '', :method => 'get', :query => '', :headers => {}}) }
22
- it "returns the full path"do
23
- expect(subject.full_path).to eq "/"
24
- end
25
- end
26
- context "with a path" do
27
- subject { described_class.from_hash({:path => '/path', :method => 'get', :query => '', :headers => {}}) }
28
- it "returns the full path"do
29
- expect(subject.full_path).to eq "/path"
30
- end
31
- end
32
- context "with a path and query" do
33
- subject { described_class.from_hash({:path => '/path', :method => 'get', :query => "something", :headers => {}}) }
34
- it "returns the full path"do
35
- expect(subject.full_path).to eq "/path?something"
36
- end
37
- end
38
- context "with a path and a query that is a Term" do
39
- subject { described_class.from_hash({:path => '/path', :method => 'get', :headers => {}, :query => Pact::Term.new(generate: 'a', matcher: /a/)}) }
40
- it "returns the full path with reified path" do
41
- expect(subject.full_path).to eq "/path?a"
42
- end
43
- end
44
- context "with a path and a query that is a QueryString" do
45
- subject { described_class.from_hash({:path => '/path', :method => 'get', :headers => {}, :query => Pact::Term.new(generate: 'a', matcher: /a/)}) }
46
- it "returns the full path with reified path" do
47
- expect(subject.full_path).to eq "/path?a"
48
- end
49
- end
50
- context "with a path and a query that is a QueryHash" do
51
- subject { described_class.from_hash({:path => '/path', :method => 'get', :headers => {}, :query => {param: 'hello', extra: 'world'}}) }
52
- it "returns the full path with reified path" do
53
- expect(subject.full_path).to eq "/path?param=hello&extra=world"
54
- end
55
- end
56
- context "with a path and a query that is a QueryHash with an embeded Term" do
57
- subject { described_class.from_hash({:path => '/path', :method => 'get', :headers => {},
58
- :query => {param: 'hello', extra: Pact::Term.new(generate: "wonderworld", matcher: /\w+world/)}}) }
59
- it "returns the full path with reified path" do
60
- expect(subject.full_path).to eq "/path?param=hello&extra=wonderworld"
61
- end
62
- end
63
- context "with a path and a query that has multiple terms" do
64
- subject { described_class.from_hash({:path => '/path', :method => 'get', :headers => {},
65
- :query => {param: 'hello', simple: 'hi', double: [ 'hello', 'world'], last: 'gone'}}) }
66
- it "returns the full path with reified path" do
67
- expect(subject.full_path).to eq "/path?param=hello&simple=hi&double=hello&double=world&last=gone"
68
- end
69
- end
70
- context "with a path and a query that has multiple terms including terms" do
71
- subject { described_class.from_hash({:path => '/path', :method => 'get', :headers => {},
72
- :query => {param: 'hello', simple: 'hi', double: [ 'hello', Pact::Term.new(generate: "wonderworld", matcher: /\w+world/)], last: 'gone'}}) }
73
- it "returns the full path with reified path" do
74
- expect(subject.full_path).to eq "/path?param=hello&simple=hi&double=hello&double=wonderworld&last=gone"
75
- end
76
- end
77
- end
78
-
79
- describe "building from a hash" do
80
-
81
- let(:raw_request) do
82
- {
83
- 'method' => 'get',
84
- 'path' => '/mallory',
85
- 'query' => 'query',
86
- 'headers' => {
87
- 'Content-Type' => 'application/json'
88
- },
89
- 'body' => 'hello mallory'
90
- }
91
- end
92
-
93
- subject { described_class.from_hash(raw_request) }
94
-
95
- it "extracts the method" do
96
- expect(subject.method).to eq 'get'
97
- end
98
-
99
- it "extracts the path" do
100
- expect(subject.path).to eq '/mallory'
101
- end
102
-
103
- it "extracts the body" do
104
- expect(subject.body).to eq 'hello mallory'
105
- end
106
-
107
- it "extracts the string query" do
108
- expect(subject.query).to eq Pact::QueryString.new('query')
109
- end
110
-
111
- it "extracts the hash query" do
112
- raw_request['query']= {param: 'hello', extra: 'world'}
113
- expect(subject.query).to eq Pact::QueryHash.new( {param: 'hello', extra: 'world'})
114
- end
115
-
116
- it "blows up if method is absent" do
117
- raw_request.delete 'method'
118
- expect { described_class.from_hash(raw_request) }.to raise_error(KeyError)
119
- end
120
-
121
- it "blows up if path is absent" do
122
- raw_request.delete 'path'
123
- expect { described_class.from_hash(raw_request) }.to raise_error(KeyError)
124
- end
125
-
126
- it "does not blow up if body is missing" do
127
- raw_request.delete 'body'
128
- expect { described_class.from_hash(raw_request) }.to_not raise_error
129
- end
130
-
131
- end
132
- end
@@ -1,29 +0,0 @@
1
- require 'pact/rspec'
2
-
3
- module Pact
4
- module SpecSupport
5
-
6
- extend self
7
-
8
- def load_fixture name
9
- File.read(File.join("./spec/fixtures", name))
10
- end
11
-
12
- def load_json_fixture name
13
- require 'json'
14
- JSON.parse(load_fixture(name))
15
- end
16
-
17
- def remove_ansicolor string
18
- string.gsub(/\e\[(\d+)m/, '')
19
- end
20
-
21
- Pact::RSpec.with_rspec_2 do
22
-
23
- def instance_double *args
24
- double(*args)
25
- end
26
-
27
- end
28
- end
29
- end
@@ -1,22 +0,0 @@
1
- {
2
- "consumer": {
3
- "name": "Consumer"
4
- },
5
- "provider": {
6
- "name": "Provider"
7
- },
8
- "interactions": [
9
- {
10
- "description": "a test request",
11
- "request": {
12
- "method": "get",
13
- "path": "/"
14
- },
15
- "response": {
16
- "status": 200,
17
- "body": "stubbing works"
18
- },
19
- "provider_state": "something is stubbed"
20
- }
21
- ]
22
- }
@@ -1,48 +0,0 @@
1
- {
2
- "consumer": {
3
- "name": "some-test-consumer"
4
- },
5
- "provider": {
6
- "name": "an unknown provider"
7
- },
8
- "interactions": [
9
- {
10
- "description": "a test request",
11
- "request": {
12
- "method": "get",
13
- "path": "/weather",
14
- "query": ""
15
- },
16
- "response": {
17
- "status": 200,
18
- "headers" : {
19
- "Content-type": {
20
- "json_class": "Pact::Term",
21
- "data": {
22
- "generate": "text/plain",
23
- "matcher": {
24
- "json_class": "Regexp",
25
- "o": 0,
26
- "s": "text"
27
- }
28
- }
29
- }
30
- },
31
- "body": {
32
- "message" : {
33
- "json_class": "Pact::Term",
34
- "data": {
35
- "generate": "rainy",
36
- "matcher": {
37
- "json_class": "Regexp",
38
- "o": 0,
39
- "s": "rain"
40
- }
41
- }
42
- }
43
- }
44
- },
45
- "provider_state": "the weather is sunny"
46
- }
47
- ]
48
- }
@@ -1,61 +0,0 @@
1
- {
2
- "consumer": {
3
- "name": "an unknown consumer"
4
- },
5
- "provider": {
6
- "name": "an unknown provider"
7
- },
8
- "interactions": [
9
- {
10
- "description": "a test request",
11
- "request": {
12
- "method": "get",
13
- "path": "/weather",
14
- "query": ""
15
- },
16
- "response": {
17
- "status": 200,
18
- "headers" : {"Content-type": "application/json"},
19
- "body": {"message" : "this is not the weather you are looking for", "array": [{"foo": "bar"}], "somethingElse" : {"blah" : {"nested" : "that is missing"} }}
20
-
21
- },
22
- "provider_state": "the weather is cloudy"
23
- },{
24
- "description": "another test request",
25
- "request": {
26
- "method": "get",
27
- "path": "/weather",
28
- "query": ""
29
- },
30
- "response": {
31
- "status": 200,
32
- "headers" : {
33
- "Content-type": {
34
- "json_class": "Pact::Term",
35
- "data": {
36
- "generate": "application/hal+json",
37
- "matcher": {"json_class":"Regexp","o":0,"s":"hal"}
38
- }
39
- },
40
- "X-Special-Header": "something"
41
- },
42
- "body": {"message" : "this is not the weather you are looking for"}
43
-
44
- }
45
- },{
46
- "description": "another test request",
47
- "provider_state": "a missing provider state",
48
- "request": {
49
- "method": "get",
50
- "path": "/weather",
51
- "query": ""
52
- },
53
- "response": {
54
- "status": 200,
55
- "headers" : {"Content-type": "application/json"},
56
- "body": {"message" : "this is not the weather you are looking for"}
57
-
58
- }
59
- }
60
- ]
61
- }
@@ -1,38 +0,0 @@
1
- {
2
- "consumer": {
3
- "name": "some-test-consumer"
4
- },
5
- "provider": {
6
- "name": "an unknown provider"
7
- },
8
- "interactions": [
9
- {
10
- "description": "a test request",
11
- "request": {
12
- "method": "get",
13
- "path": "/weather",
14
- "query": ""
15
- },
16
- "response": {
17
- "status": 200,
18
- "headers" : {"Content-type": "application/json"},
19
- "body": {"message" : "sunny"}
20
- },
21
- "provider_state": "the weather is sunny"
22
- },
23
- {
24
- "description": "a test request for text",
25
- "request": {
26
- "method": "get",
27
- "path": "/sometext",
28
- "query": "",
29
- "body" : "some request text"
30
- },
31
- "response": {
32
- "status": 200,
33
- "headers" : {"Content-type": "text/plain"},
34
- "body": "some text"
35
- }
36
- }
37
- ]
38
- }