pact 1.4.0.rc4 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/CHANGELOG.md +13 -0
  2. data/lib/pact/consumer/configuration/mock_service.rb +2 -1
  3. data/lib/pact/consumer/consumer_contract_builder.rb +2 -1
  4. data/lib/pact/version.rb +1 -1
  5. data/pact.gemspec +4 -3
  6. metadata +32 -205
  7. data/.gitignore +0 -29
  8. data/.rspec +0 -2
  9. data/.travis.yml +0 -8
  10. data/Gemfile +0 -9
  11. data/Gemfile.lock +0 -108
  12. data/README.md +0 -314
  13. data/Rakefile +0 -9
  14. data/config.ru +0 -3
  15. data/documentation/README.md +0 -13
  16. data/documentation/configuration.md +0 -166
  17. data/documentation/diff_formatter_embedded.png +0 -0
  18. data/documentation/diff_formatter_list.png +0 -0
  19. data/documentation/diff_formatter_unix.png +0 -0
  20. data/example/animal-service/Gemfile +0 -14
  21. data/example/animal-service/Gemfile.lock +0 -69
  22. data/example/animal-service/Rakefile +0 -5
  23. data/example/animal-service/config.ru +0 -3
  24. data/example/animal-service/db/animal_db.sqlite3 +0 -0
  25. data/example/animal-service/lib/animal_service/animal_repository.rb +0 -12
  26. data/example/animal-service/lib/animal_service/api.rb +0 -29
  27. data/example/animal-service/lib/animal_service/db.rb +0 -5
  28. data/example/animal-service/spec/service_consumers/pact_helper.rb +0 -11
  29. data/example/animal-service/spec/service_consumers/provider_states_for_zoo_app.rb +0 -26
  30. data/example/zoo-app/Gemfile +0 -12
  31. data/example/zoo-app/Gemfile.lock +0 -63
  32. data/example/zoo-app/Rakefile +0 -5
  33. data/example/zoo-app/doc/pacts/markdown/README.md +0 -3
  34. data/example/zoo-app/doc/pacts/markdown/Zoo App - Animal Service.md +0 -75
  35. data/example/zoo-app/lib/zoo_app/animal_service_client.rb +0 -31
  36. data/example/zoo-app/lib/zoo_app/models/alligator.rb +0 -17
  37. data/example/zoo-app/spec/pacts/zoo_app-animal_service.json +0 -67
  38. data/example/zoo-app/spec/service_providers/animal_service_client_spec.rb +0 -71
  39. data/example/zoo-app/spec/service_providers/pact_helper.rb +0 -15
  40. data/example/zoo-app/spec/spec_helper.rb +0 -6
  41. data/scratchpad.rb +0 -52
  42. data/spec/features/consumption_spec.rb +0 -114
  43. data/spec/features/production_spec.rb +0 -155
  44. data/spec/features/provider_states/zebras.rb +0 -28
  45. data/spec/integration/consumer_async_request_spec.rb +0 -46
  46. data/spec/integration/consumer_more_than_one_matching_interaction_spec.rb +0 -49
  47. data/spec/integration/consumer_no_matching_interaction_spec.rb +0 -53
  48. data/spec/integration/consumer_with_a_provider_state_spec.rb +0 -44
  49. data/spec/integration/consumer_with_form_hash_spec.rb +0 -62
  50. data/spec/integration/consumer_with_form_spec.rb +0 -50
  51. data/spec/integration/consumer_with_params_hash_spec.rb +0 -122
  52. data/spec/integration/pact/consumer_configuration_spec.rb +0 -66
  53. data/spec/integration/pact/provider_configuration_spec.rb +0 -25
  54. data/spec/lib/pact/cli_spec.rb +0 -47
  55. data/spec/lib/pact/configuration_spec.rb +0 -297
  56. data/spec/lib/pact/consumer/app_manager_spec.rb +0 -41
  57. data/spec/lib/pact/consumer/configuration_spec.rb +0 -57
  58. data/spec/lib/pact/consumer/consumer_contract_builder_spec.rb +0 -69
  59. data/spec/lib/pact/consumer/interaction_builder_spec.rb +0 -87
  60. data/spec/lib/pact/consumer/interactions_spec.rb +0 -64
  61. data/spec/lib/pact/consumer/mock_service/app_spec.rb +0 -52
  62. data/spec/lib/pact/consumer/mock_service/interaction_list_spec.rb +0 -78
  63. data/spec/lib/pact/consumer/mock_service/interaction_mismatch_spec.rb +0 -70
  64. data/spec/lib/pact/consumer/mock_service/interaction_replay_spec.rb +0 -12
  65. data/spec/lib/pact/consumer/mock_service/rack_request_helper_spec.rb +0 -88
  66. data/spec/lib/pact/consumer/mock_service/verification_get_spec.rb +0 -142
  67. data/spec/lib/pact/consumer/service_consumer_spec.rb +0 -11
  68. data/spec/lib/pact/doc/generator_spec.rb +0 -84
  69. data/spec/lib/pact/doc/interaction_view_model_spec.rb +0 -132
  70. data/spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb +0 -29
  71. data/spec/lib/pact/doc/markdown/index_renderer_spec.rb +0 -29
  72. data/spec/lib/pact/provider/configuration/configuration_extension_spec.rb +0 -17
  73. data/spec/lib/pact/provider/configuration/pact_verification_spec.rb +0 -43
  74. data/spec/lib/pact/provider/configuration/service_provider_config_spec.rb +0 -21
  75. data/spec/lib/pact/provider/configuration/service_provider_dsl_spec.rb +0 -108
  76. data/spec/lib/pact/provider/configuration_spec.rb +0 -50
  77. data/spec/lib/pact/provider/matchers/messages_spec.rb +0 -116
  78. data/spec/lib/pact/provider/pact_helper_locator_spec.rb +0 -54
  79. data/spec/lib/pact/provider/print_missing_provider_states_spec.rb +0 -19
  80. data/spec/lib/pact/provider/request_spec.rb +0 -78
  81. data/spec/lib/pact/provider/rspec/formatter_rspec_2_spec.rb +0 -68
  82. data/spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb +0 -72
  83. data/spec/lib/pact/provider/rspec_spec.rb +0 -55
  84. data/spec/lib/pact/provider/state/provider_state_manager_spec.rb +0 -89
  85. data/spec/lib/pact/provider/state/provider_state_proxy_spec.rb +0 -80
  86. data/spec/lib/pact/provider/state/provider_state_spec.rb +0 -213
  87. data/spec/lib/pact/provider/world_spec.rb +0 -41
  88. data/spec/lib/pact/tasks/task_helper_spec.rb +0 -74
  89. data/spec/lib/pact/tasks/verification_task_spec.rb +0 -75
  90. data/spec/pact_specification/compliance-1.0.0.rb +0 -47
  91. data/spec/spec_helper.rb +0 -22
  92. data/spec/standalone/consumer_fail_test.rb +0 -55
  93. data/spec/standalone/consumer_pass_test.rb +0 -51
  94. data/spec/support/a_consumer-a_producer.json +0 -32
  95. data/spec/support/a_consumer-a_provider.json +0 -32
  96. data/spec/support/active_support_if_configured.rb +0 -6
  97. data/spec/support/app_for_config_ru.rb +0 -4
  98. data/spec/support/case-insensitive-response-header-matching.json +0 -21
  99. data/spec/support/case-insensitive-response-header-matching.rb +0 -15
  100. data/spec/support/consumer_contract_template.json +0 -24
  101. data/spec/support/factories.rb +0 -82
  102. data/spec/support/generated_index.md +0 -4
  103. data/spec/support/generated_markdown.md +0 -55
  104. data/spec/support/interaction_view_model.json +0 -63
  105. data/spec/support/interaction_view_model_with_terms.json +0 -50
  106. data/spec/support/markdown_pact.json +0 -48
  107. data/spec/support/missing_provider_states_output.txt +0 -25
  108. data/spec/support/options.json +0 -21
  109. data/spec/support/options_app.rb +0 -15
  110. data/spec/support/pact_helper.rb +0 -57
  111. data/spec/support/shared_examples_for_request.rb +0 -94
  112. data/spec/support/spec_support.rb +0 -20
  113. data/spec/support/stubbing.json +0 -22
  114. data/spec/support/stubbing_using_allow.rb +0 -29
  115. data/spec/support/term.json +0 -48
  116. data/spec/support/test_app_fail.json +0 -61
  117. data/spec/support/test_app_pass.json +0 -38
  118. data/spec/support/test_app_with_right_content_type_differ.json +0 -23
  119. data/tasks/pact-test.rake +0 -114
  120. data/tasks/spec.rake +0 -8
Binary file
Binary file
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- group :development, :test do
4
- gem 'rspec'
5
- gem 'pact', path: '../../'
6
- gem 'pry'
7
- end
8
-
9
- gem 'rake'
10
- gem 'rack', '~>1.5.2'
11
- gem 'json', '~>1.6'
12
- gem 'sqlite3'
13
- gem 'sequel'
14
- gem 'sinatra'
@@ -1,69 +0,0 @@
1
- PATH
2
- remote: ../../
3
- specs:
4
- pact (1.1.0.rc2)
5
- awesome_print (~> 1.1)
6
- find_a_port (~> 1.0.1)
7
- json
8
- rack-test (~> 0.6.2)
9
- randexp (~> 0.1.7)
10
- rspec (~> 2.12)
11
- term-ansicolor (~> 1.0)
12
- thor
13
- webrick
14
-
15
- GEM
16
- remote: https://rubygems.org/
17
- specs:
18
- awesome_print (1.2.0)
19
- coderay (1.0.9)
20
- diff-lcs (1.2.4)
21
- find_a_port (1.0.1)
22
- json (1.6.8)
23
- method_source (0.8.2)
24
- pry (0.9.12.2)
25
- coderay (~> 1.0.5)
26
- method_source (~> 0.8)
27
- slop (~> 3.4)
28
- rack (1.5.2)
29
- rack-protection (1.5.1)
30
- rack
31
- rack-test (0.6.2)
32
- rack (>= 1.0)
33
- rake (10.1.0)
34
- randexp (0.1.7)
35
- rspec (2.14.1)
36
- rspec-core (~> 2.14.0)
37
- rspec-expectations (~> 2.14.0)
38
- rspec-mocks (~> 2.14.0)
39
- rspec-core (2.14.5)
40
- rspec-expectations (2.14.2)
41
- diff-lcs (>= 1.1.3, < 2.0)
42
- rspec-mocks (2.14.3)
43
- sequel (4.5.0)
44
- sinatra (1.4.4)
45
- rack (~> 1.4)
46
- rack-protection (~> 1.4)
47
- tilt (~> 1.3, >= 1.3.4)
48
- slop (3.4.6)
49
- sqlite3 (1.3.8)
50
- term-ansicolor (1.3.0)
51
- tins (~> 1.0)
52
- thor (0.19.1)
53
- tilt (1.4.1)
54
- tins (1.1.0)
55
- webrick (1.3.1)
56
-
57
- PLATFORMS
58
- ruby
59
-
60
- DEPENDENCIES
61
- json (~> 1.6)
62
- pact!
63
- pry
64
- rack (~> 1.5.2)
65
- rake
66
- rspec
67
- sequel
68
- sinatra
69
- sqlite3
@@ -1,5 +0,0 @@
1
- $: << File.join(File.dirname(__FILE__), "lib")
2
-
3
- require 'pact/tasks'
4
-
5
- task :default => 'pact:verify'
@@ -1,3 +0,0 @@
1
- require File.dirname(__FILE__) + '/lib/animal_service/api'
2
-
3
- run AnimalService::Api
@@ -1,12 +0,0 @@
1
- require 'sequel'
2
- require_relative 'db'
3
-
4
- module AnimalService
5
- class AnimalRepository
6
-
7
- def self.find_alligator_by_name name
8
- DATABASE[:animals].where(name: name).single_record
9
- end
10
-
11
- end
12
- end
@@ -1,29 +0,0 @@
1
- require 'sinatra/base'
2
- require_relative 'animal_repository'
3
- require 'json'
4
-
5
- module AnimalService
6
-
7
- class Api < Sinatra::Base
8
-
9
- set :raise_errors, false
10
- set :show_exceptions, false
11
-
12
- error do
13
- e = env['sinatra.error']
14
- content_type :json
15
- status 500
16
- {error: e.message, backtrace: e.backtrace}.to_json
17
- end
18
-
19
- get '/alligators/:name' do
20
- if (alligator = AnimalRepository.find_alligator_by_name(params[:name]))
21
- content_type :json
22
- alligator.to_json
23
- else
24
- status 404
25
- end
26
- end
27
-
28
- end
29
- end
@@ -1,5 +0,0 @@
1
- require 'sequel'
2
-
3
- module AnimalService
4
- DATABASE ||= Sequel.connect(adapter: 'sqlite', database: './db/animal_db.sqlite3')
5
- end
@@ -1,11 +0,0 @@
1
- require 'pact/provider/rspec'
2
-
3
- require "./spec/service_consumers/provider_states_for_zoo_app"
4
-
5
- Pact.service_provider 'Animal Service' do
6
-
7
- honours_pact_with "Zoo App" do
8
- pact_uri '../zoo-app/spec/pacts/zoo_app-animal_service.json'
9
- end
10
-
11
- end
@@ -1,26 +0,0 @@
1
- require 'sequel'
2
- require 'animal_service/db'
3
- require 'animal_service/animal_repository'
4
-
5
- Pact.provider_states_for "Zoo App" do
6
-
7
- set_up do
8
- AnimalService::DATABASE[:animals].truncate
9
- end
10
-
11
- provider_state "there is an alligator named Mary" do
12
- set_up do
13
- AnimalService::DATABASE[:animals].insert(name: 'Mary')
14
- end
15
- end
16
-
17
- provider_state "there is not an alligator named Mary" do
18
- no_op
19
- end
20
-
21
- provider_state "an error occurs retrieving an alligator" do
22
- set_up do
23
- allow(AnimalService::AnimalRepository).to receive(:find_alligator_by_name).and_raise("Argh!!!")
24
- end
25
- end
26
- end
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- group :development, :test do
4
- gem 'rspec'
5
- gem 'pact', path: '../../'
6
- gem 'pry'
7
- end
8
-
9
- gem 'rake'
10
- gem 'rack', '~>1.5.2'
11
- gem 'json', '~>1.6.8'
12
- gem 'httparty'
@@ -1,63 +0,0 @@
1
- PATH
2
- remote: ../../
3
- specs:
4
- pact (1.1.0.rc3)
5
- awesome_print (~> 1.1)
6
- find_a_port (~> 1.0.1)
7
- json
8
- rack-test (~> 0.6.2)
9
- randexp (~> 0.1.7)
10
- rspec (~> 2.12)
11
- term-ansicolor (~> 1.0)
12
- thor
13
- webrick
14
-
15
- GEM
16
- remote: https://rubygems.org/
17
- specs:
18
- awesome_print (1.2.0)
19
- coderay (1.0.9)
20
- diff-lcs (1.2.4)
21
- find_a_port (1.0.1)
22
- httparty (0.11.0)
23
- multi_json (~> 1.0)
24
- multi_xml (>= 0.5.2)
25
- json (1.6.8)
26
- method_source (0.8.2)
27
- multi_json (1.7.9)
28
- multi_xml (0.5.5)
29
- pry (0.9.12.2)
30
- coderay (~> 1.0.5)
31
- method_source (~> 0.8)
32
- slop (~> 3.4)
33
- rack (1.5.2)
34
- rack-test (0.6.2)
35
- rack (>= 1.0)
36
- rake (10.1.0)
37
- randexp (0.1.7)
38
- rspec (2.14.1)
39
- rspec-core (~> 2.14.0)
40
- rspec-expectations (~> 2.14.0)
41
- rspec-mocks (~> 2.14.0)
42
- rspec-core (2.14.5)
43
- rspec-expectations (2.14.2)
44
- diff-lcs (>= 1.1.3, < 2.0)
45
- rspec-mocks (2.14.3)
46
- slop (3.4.6)
47
- term-ansicolor (1.3.0)
48
- tins (~> 1.0)
49
- thor (0.19.1)
50
- tins (1.1.0)
51
- webrick (1.3.1)
52
-
53
- PLATFORMS
54
- ruby
55
-
56
- DEPENDENCIES
57
- httparty
58
- json (~> 1.6.8)
59
- pact!
60
- pry
61
- rack (~> 1.5.2)
62
- rake
63
- rspec
@@ -1,5 +0,0 @@
1
- require 'rspec/core/rake_task'
2
-
3
- RSpec::Core::RakeTask.new(:spec)
4
-
5
- task :default => :spec
@@ -1,3 +0,0 @@
1
- ### Pacts for Zoo App
2
-
3
- * [Animal Service](Zoo App - Animal Service.md)
@@ -1,75 +0,0 @@
1
- ### A pact between Zoo App and Animal Service
2
-
3
- #### Requests from Zoo App to Animal Service
4
-
5
- * [A request for an alligator](#a_request_for_an_alligator_given_there_is_an_alligator_named_Mary) given there is an alligator named Mary
6
-
7
- * [A request for an alligator](#a_request_for_an_alligator_given_there_is_not_an_alligator_named_Mary) given there is not an alligator named Mary
8
-
9
- * [A request for an alligator](#a_request_for_an_alligator_given_an_error_occurs_retrieving_an_alligator) given an error occurs retrieving an alligator
10
-
11
- #### Interactions
12
-
13
- <a name="a_request_for_an_alligator_given_there_is_an_alligator_named_Mary"></a>
14
- Given **there is an alligator named Mary**, upon receiving **a request for an alligator** from Zoo App, with
15
- ```json
16
- {
17
- "method": "get",
18
- "path": "/alligators/Mary",
19
- "headers": {
20
- "Accept": "application/json"
21
- }
22
- }
23
- ```
24
- Animal Service will respond with:
25
- ```json
26
- {
27
- "status": 200,
28
- "headers": {
29
- "Content-Type": "application/json;charset=utf-8"
30
- },
31
- "body": {
32
- "name": "Mary"
33
- }
34
- }
35
- ```
36
- <a name="a_request_for_an_alligator_given_there_is_not_an_alligator_named_Mary"></a>
37
- Given **there is not an alligator named Mary**, upon receiving **a request for an alligator** from Zoo App, with
38
- ```json
39
- {
40
- "method": "get",
41
- "path": "/alligators/Mary",
42
- "headers": {
43
- "Accept": "application/json"
44
- }
45
- }
46
- ```
47
- Animal Service will respond with:
48
- ```json
49
- {
50
- "status": 404
51
- }
52
- ```
53
- <a name="a_request_for_an_alligator_given_an_error_occurs_retrieving_an_alligator"></a>
54
- Given **an error occurs retrieving an alligator**, upon receiving **a request for an alligator** from Zoo App, with
55
- ```json
56
- {
57
- "method": "get",
58
- "path": "/alligators/Mary",
59
- "headers": {
60
- "Accept": "application/json"
61
- }
62
- }
63
- ```
64
- Animal Service will respond with:
65
- ```json
66
- {
67
- "status": 500,
68
- "headers": {
69
- "Content-Type": "application/json;charset=utf-8"
70
- },
71
- "body": {
72
- "error": "Argh!!!"
73
- }
74
- }
75
- ```
@@ -1,31 +0,0 @@
1
- require 'httparty'
2
- require 'zoo_app/models/alligator'
3
-
4
- module ZooApp
5
- class AnimalServiceClient
6
-
7
- include HTTParty
8
- base_uri 'animal-service.com'
9
-
10
- def self.find_alligator_by_name name
11
- response = get("/alligators/#{name}", :headers => {'Accept' => 'application/json'})
12
- when_successful(response) do
13
- ZooApp::Animals::Alligator.new(parse_body(response))
14
- end
15
- end
16
-
17
- def self.when_successful response
18
- if response.success?
19
- yield
20
- elsif response.code == 404
21
- nil
22
- else
23
- raise response.body
24
- end
25
- end
26
-
27
- def self.parse_body response
28
- JSON.parse(response.body, {:symbolize_names => true})
29
- end
30
- end
31
- end
@@ -1,17 +0,0 @@
1
- module ZooApp
2
- module Animals
3
- class Alligator
4
-
5
- attr_reader :name
6
-
7
- def initialize attributes
8
- @name = attributes[:name]
9
- end
10
-
11
- def == other
12
- other.is_a?(Alligator) && other.name == self.name
13
- end
14
-
15
- end
16
- end
17
- end
@@ -1,67 +0,0 @@
1
- {
2
- "provider": {
3
- "name": "Animal Service"
4
- },
5
- "consumer": {
6
- "name": "Zoo App"
7
- },
8
- "interactions": [
9
- {
10
- "description": "a request for an alligator",
11
- "provider_state": "there is an alligator named Mary",
12
- "request": {
13
- "method": "get",
14
- "path": "/alligators/Mary",
15
- "headers": {
16
- "Accept": "application/json"
17
- }
18
- },
19
- "response": {
20
- "status": 200,
21
- "headers": {
22
- "Content-Type": "application/json;charset=utf-8"
23
- },
24
- "body": {
25
- "name": "Mary"
26
- }
27
- }
28
- },
29
- {
30
- "description": "a request for an alligator",
31
- "provider_state": "there is not an alligator named Mary",
32
- "request": {
33
- "method": "get",
34
- "path": "/alligators/Mary",
35
- "headers": {
36
- "Accept": "application/json"
37
- }
38
- },
39
- "response": {
40
- "status": 404
41
- }
42
- },
43
- {
44
- "description": "a request for an alligator",
45
- "provider_state": "an error occurs retrieving an alligator",
46
- "request": {
47
- "method": "get",
48
- "path": "/alligators/Mary",
49
- "headers": {
50
- "Accept": "application/json"
51
- }
52
- },
53
- "response": {
54
- "status": 500,
55
- "headers": {
56
- "Content-Type": "application/json;charset=utf-8"
57
- },
58
- "body": {
59
- "error": "Argh!!!"
60
- }
61
- }
62
- }
63
- ],
64
- "metadata": {
65
- "pactSpecificationVersion": "1.0.0"
66
- }
67
- }