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
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --format documentation
3
- --require spec_helper
@@ -1,29 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 2.1.8
5
- - 2.2.4
6
- - 2.3.1
7
- - 2.4.3
8
- - 2.5.0
9
- - jruby-9.1.13.0
10
- gemfile:
11
- - gemfiles/default.gemfile
12
- - gemfiles/ruby_under_22.gemfile
13
- matrix:
14
- exclude:
15
- # rack 2.0 and activesupport 5.0 no longer support ruby under 2.2.
16
- - rvm: 2.0.0
17
- gemfile: gemfiles/default.gemfile
18
- - rvm: 2.1.8
19
- gemfile: gemfiles/default.gemfile
20
- - rvm: 2.2.4
21
- gemfile: gemfiles/ruby_under_22.gemfile
22
- - rvm: 2.3.1
23
- gemfile: gemfiles/ruby_under_22.gemfile
24
- - rvm: 2.4.3
25
- gemfile: gemfiles/ruby_under_22.gemfile
26
- - rvm: 2.5.0
27
- gemfile: gemfiles/ruby_under_22.gemfile
28
- - rvm: jruby-9.1.13.0
29
- gemfile: gemfiles/ruby_under_22.gemfile
data/Appraisals DELETED
@@ -1,7 +0,0 @@
1
- appraise "default" do
2
- end
3
-
4
- appraise "ruby-under-22" do
5
- gem "rack", "< 2.0"
6
- gem "activesupport", "< 5.0.0"
7
- end
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in pact.gemspec
4
- gemspec
@@ -1,5 +0,0 @@
1
- # Releasing
2
-
3
- Run
4
-
5
- script/release.sh [major|minor|patch] # default is minor
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- Dir.glob('./lib/tasks/**/*.rake').each { |task| load task }
4
- Dir.glob('./tasks/**/*.rake').each { |task| load task }
@@ -1,5 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gemspec :path => "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rack", "< 2.0"
6
- gem "activesupport", "< 5.0.0"
7
-
8
- gemspec :path => "../"
@@ -1,39 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'pact/support/version'
5
-
6
- Gem::Specification.new do |gem|
7
- gem.name = "pact-support"
8
- gem.version = Pact::Support::VERSION
9
- gem.authors = ["James Fraser", "Sergei Matheson", "Brent Snook", "Ronald Holshausen", "Beth Skurrie"]
10
- gem.email = ["james.fraser@alumni.swinburne.edu", "sergei.matheson@gmail.com", "brent@fuglylogic.com", "uglyog@gmail.com", "bskurrie@dius.com.au"]
11
- gem.summary = %q{Shared code for Pact gems}
12
- gem.homepage = "https://github.com/bethesque/pact-support"
13
-
14
- gem.required_ruby_version = '>= 2.0'
15
-
16
- gem.files = `git ls-files`.split($/)
17
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ["lib"]
20
- gem.license = 'MIT'
21
-
22
- gem.add_runtime_dependency 'randexp', '~> 0.1.7'
23
- gem.add_runtime_dependency 'rspec', '>=2.14'
24
- gem.add_runtime_dependency 'json'
25
- gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
26
- gem.add_runtime_dependency 'find_a_port', '~> 1.0.1'
27
- gem.add_runtime_dependency 'thor'
28
- gem.add_runtime_dependency 'awesome_print', '~> 1.1'
29
-
30
- gem.add_development_dependency 'rake', '~> 10.0.3'
31
- gem.add_development_dependency 'webmock', '~> 3.3'
32
- gem.add_development_dependency 'pry'
33
- gem.add_development_dependency 'fakefs', '~> 0.11.2'
34
- gem.add_development_dependency 'hashie', '~> 2.0'
35
- gem.add_development_dependency 'activesupport'
36
- gem.add_development_dependency 'appraisal'
37
- gem.add_development_dependency 'conventional-changelog', '~>1.3'
38
- gem.add_development_dependency 'bump', '~> 0.5'
39
- end
@@ -1,9 +0,0 @@
1
- #!/bin/sh
2
- set -e
3
-
4
- git checkout -- lib/pact/support/version.rb
5
- bundle exec bump ${1:-minor} --no-commit
6
- bundle exec rake generate_changelog
7
- git add CHANGELOG.md lib/pact/support/version.rb
8
- git commit -m "chore(release): version $(ruby -r ./lib/pact/support/version.rb -e "puts Pact::Support::VERSION")"
9
- bundle exec rake release
@@ -1,9 +0,0 @@
1
- #!/bin/sh
2
-
3
- # git remote add pact-specification git@github.com:bethesque/pact-specification.git
4
- # git fetch pact-specification
5
- # git subtree add --prefix spec/support/pact-specification-v2 pact-specification/version-2 --squash
6
-
7
- git remote add pact-specification git@github.com:bethesque/pact-specification.git
8
- git fetch pact-specification
9
- git subtree pull --prefix spec/support/pact-specification-v2 pact-specification/version-2 --squash
@@ -1,27 +0,0 @@
1
- {
2
- "description": "a request to make something",
3
- "providerState" : null,
4
- "request" : {
5
- "method" : "POST",
6
- "path" : "/something",
7
- "body": {
8
- "name": "Mary"
9
- },
10
- "matchingRules": {
11
- "$.body.name" : {"regex" : ".+"}
12
- }
13
- },
14
- "response" : {
15
- "status" : 200,
16
- "body" : {
17
- "_links" : {
18
- "self" : {
19
- "href" : "http://localhost:1234/things/1"
20
- }
21
- }
22
- },
23
- "matchingRules" : {
24
- "$.body._links.self.href": {"regex": "http:\\/\\/.*\\/\\d+"}
25
- }
26
- }
27
- }
@@ -1,9 +0,0 @@
1
-
2
-
3
- Description of differences
4
- --------------------------------------
5
- * Wrong header
6
-
7
- @@ -1,2 +1,2 @@
8
- -bar
9
- +foo
@@ -1,3 +0,0 @@
1
- {
2
- "foo": "bar"
3
- }
@@ -1,36 +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
- "matchingRules": {
18
- "$.headers.Content-Type" : {
19
- "match": "regex", "regex": "json"
20
- },
21
- "$.body.message" : {
22
- "match": "regex", "regex": "sun"
23
- }
24
- },
25
- "status": 200,
26
- "headers" : {
27
- "Content-Type": "foo/json"
28
- },
29
- "body": {
30
- "message" : "sunful"
31
- }
32
- },
33
- "provider_state": "the weather is sunny"
34
- }
35
- ]
36
- }
@@ -1,36 +0,0 @@
1
- {
2
- "consumer": {
3
- "name": "consumer"
4
- },
5
- "interactions": [
6
- {
7
- "description": "a test request",
8
- "providerState": "the weather is sunny",
9
- "request": {
10
- "method": "get",
11
- "path": "/foo"
12
- },
13
- "response": {
14
- "body": {
15
- "foo": "bar"
16
- },
17
- "matchingRules": {
18
- "body": {
19
- "$.foo": {
20
- "matchers": [{ "match": "type" }]
21
- }
22
- }
23
- },
24
- "status": 200
25
- }
26
- }
27
- ],
28
- "provider": {
29
- "name": "provider"
30
- },
31
- "metadata": {
32
- "pactSpecification": {
33
- "version": "3.0"
34
- }
35
- }
36
- }
@@ -1,127 +0,0 @@
1
- require 'pact/term'
2
- require 'pact/something_like'
3
- require 'pact/matching_rules/extract'
4
- require 'pact/matching_rules/v3/extract'
5
- require 'pact/matching_rules/merge'
6
- require 'pact/matching_rules/v3/merge'
7
- require 'pact/reification'
8
-
9
- describe "converting Pact::Term and Pact::SomethingLike to matching rules and back again" do
10
-
11
- let(:example) { Pact::Reification.from_term expected }
12
- let(:matching_rules) { Pact::MatchingRules::Extract.(expected) }
13
- let(:recreated_expected) { Pact::MatchingRules::Merge.(example, matching_rules)}
14
-
15
- let(:recreated_expected_v3) { Pact::MatchingRules::V3::Merge.(example, matching_rules_v3) }
16
- let(:matching_rules_v3) { Pact::MatchingRules::V3::Extract.(expected) }
17
-
18
- context "with a Pact::Term" do
19
- let(:expected) do
20
- {
21
- body: {
22
- alligator: {
23
- name: Pact::Term.new(generate: 'Mary', matcher: /M/)
24
- }
25
- }
26
- }
27
- end
28
-
29
- it "recreates the same object hierarchy with v2 matching" do
30
- expect(recreated_expected).to eq expected
31
- end
32
-
33
- it "recreates the same object hierarchy with v3 matching" do
34
- expect(recreated_expected_v3).to eq expected
35
- end
36
- end
37
-
38
- context "with a Pact::SomethingLike containing a Pact::ArrayLike" do
39
- let(:expected) do
40
- {
41
- body: Pact::SomethingLike.new(children: Pact::ArrayLike.new("foo", min: 2))
42
- }
43
- end
44
-
45
- it "recreates the same object hierarchy with v2 matching" do
46
- expect(recreated_expected).to eq expected
47
- end
48
-
49
- it "recreates the same object hierarchy with v3 matching" do
50
- expect(recreated_expected_v3).to eq expected
51
- end
52
- end
53
-
54
- context "with a Pact::SomethingLike" do
55
- let(:expected) do
56
- {
57
- body: {
58
- alligator: {
59
- name: Pact::SomethingLike.new("Mary")
60
- }
61
- }
62
- }
63
- end
64
-
65
- it "recreates the same object hierarchy with v2 matching" do
66
- expect(recreated_expected).to eq expected
67
- end
68
-
69
- it "recreates the same object hierarchy with v3 matching" do
70
- expect(recreated_expected_v3).to eq expected
71
- end
72
- end
73
-
74
- context "with a Pact::SomethingLike containing a Hash" do
75
- let(:expected) do
76
- {
77
- body: {
78
- alligator: Pact::SomethingLike.new(name: 'Mary')
79
- }
80
- }
81
- end
82
-
83
- let(:similar) do
84
- {
85
- body: {
86
- alligator: {
87
- name: Pact::SomethingLike.new('Mary')
88
- }
89
- }
90
- }
91
- end
92
-
93
- it "recreates the same object hierarchy with v2 matching" do
94
- expect(recreated_expected).to eq expected
95
- end
96
-
97
- it "recreates the same object hierarchy with v3 matching" do
98
- expect(recreated_expected_v3).to eq expected
99
- end
100
- end
101
-
102
- context "with a Pact::SomethingLike containing an Array" do
103
- let(:expected) do
104
- {
105
- body: {
106
- alligators: Pact::SomethingLike.new(["Mary", "Betty"])
107
- }
108
- }
109
- end
110
-
111
- let(:similar) do
112
- {
113
- body: {
114
- alligators: [Pact::SomethingLike.new("Mary"), Pact::SomethingLike.new("Betty")]
115
- }
116
- }
117
- end
118
-
119
- it "recreates the same object hierarchy with v2 matching" do
120
- expect(recreated_expected).to eq expected
121
- end
122
-
123
- it "recreates the same object hierarchy with v3 matching" do
124
- expect(recreated_expected_v3).to eq expected
125
- end
126
- end
127
- end
@@ -1,37 +0,0 @@
1
- require 'pact/array_like'
2
-
3
- module Pact
4
- describe ArrayLike do
5
-
6
- describe "#eq" do
7
- subject { ArrayLike.new({name: 'Fred'}, {min: 3}) }
8
- context "when the contents and min are the same" do
9
- let(:other) { ArrayLike.new({name: 'Fred'}, {min: 3}) }
10
- it "returns true" do
11
- expect(subject).to eq other
12
- end
13
-
14
- end
15
- context "when the contents are different" do
16
- let(:other) { ArrayLike.new({name: 'John'}, {min: 3}) }
17
- it "returns false" do
18
- expect(subject).to_not eq other
19
- end
20
- end
21
- context "when the min is different" do
22
- let(:other) { ArrayLike.new({name: 'Fred'}, {min: 1}) }
23
- it "returns false" do
24
- expect(subject).to_not eq other
25
- end
26
- end
27
- end
28
-
29
- subject { ArrayLike.new({name: Pact::Term.new(generate: 'Fred', matcher: /F/)}, {min: 2}) }
30
-
31
- describe "#generate" do
32
- it "creates an array with the reified example" do
33
- expect(subject.generate).to eq [{name: 'Fred'},{name: 'Fred'}]
34
- end
35
- end
36
- end
37
- end
@@ -1,61 +0,0 @@
1
- require 'spec_helper'
2
- require 'pact/configuration'
3
-
4
- module Pact
5
-
6
- describe Configuration do
7
-
8
- subject { Configuration.default_configuration }
9
-
10
- describe "#color_enabled" do
11
-
12
- it "sets color_enabled to be true by default" do
13
- expect(subject.color_enabled).to be true
14
- end
15
-
16
- it "allows configuration of colour_enabled" do
17
- subject.color_enabled = false
18
- expect(subject.color_enabled).to be false
19
- end
20
-
21
- end
22
-
23
- describe "#pactfile_write_order" do
24
- it "sets pactfile_write_order to chronological by default" do
25
- expect(subject.pactfile_write_order).to eq(:chronological)
26
- end
27
-
28
- it "allows configuration of pactfile_write_order" do
29
- subject.pactfile_write_order = :alphabetical
30
- expect(subject.pactfile_write_order).to eq(:alphabetical)
31
- end
32
- end
33
-
34
- describe "#body_differ_for_content_type" do
35
- context "when the Content-Type is nil" do
36
-
37
- before do
38
- allow(Pact.configuration.error_stream).to receive(:puts)
39
- end
40
-
41
- subject { Pact.configuration.body_differ_for_content_type nil }
42
-
43
- it "returns the TextDiffer" do
44
- expect(subject).to eq Pact::TextDiffer
45
- end
46
-
47
- it "logs a warning to log file" do
48
- expect(Pact.configuration.logger).to receive(:warn).with(/No content type found/)
49
- subject
50
- end
51
-
52
- it "logs a warning to the error stream" do
53
- expect(Pact.configuration.error_stream).to receive(:puts).with(/WARN: No content type found/)
54
- subject
55
- end
56
-
57
- end
58
- end
59
-
60
- end
61
- end