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.
- data/CHANGELOG.md +13 -0
- data/lib/pact/consumer/configuration/mock_service.rb +2 -1
- data/lib/pact/consumer/consumer_contract_builder.rb +2 -1
- data/lib/pact/version.rb +1 -1
- data/pact.gemspec +4 -3
- metadata +32 -205
- data/.gitignore +0 -29
- data/.rspec +0 -2
- data/.travis.yml +0 -8
- data/Gemfile +0 -9
- data/Gemfile.lock +0 -108
- data/README.md +0 -314
- data/Rakefile +0 -9
- data/config.ru +0 -3
- data/documentation/README.md +0 -13
- data/documentation/configuration.md +0 -166
- data/documentation/diff_formatter_embedded.png +0 -0
- data/documentation/diff_formatter_list.png +0 -0
- data/documentation/diff_formatter_unix.png +0 -0
- data/example/animal-service/Gemfile +0 -14
- data/example/animal-service/Gemfile.lock +0 -69
- data/example/animal-service/Rakefile +0 -5
- data/example/animal-service/config.ru +0 -3
- data/example/animal-service/db/animal_db.sqlite3 +0 -0
- data/example/animal-service/lib/animal_service/animal_repository.rb +0 -12
- data/example/animal-service/lib/animal_service/api.rb +0 -29
- data/example/animal-service/lib/animal_service/db.rb +0 -5
- data/example/animal-service/spec/service_consumers/pact_helper.rb +0 -11
- data/example/animal-service/spec/service_consumers/provider_states_for_zoo_app.rb +0 -26
- data/example/zoo-app/Gemfile +0 -12
- data/example/zoo-app/Gemfile.lock +0 -63
- data/example/zoo-app/Rakefile +0 -5
- data/example/zoo-app/doc/pacts/markdown/README.md +0 -3
- data/example/zoo-app/doc/pacts/markdown/Zoo App - Animal Service.md +0 -75
- data/example/zoo-app/lib/zoo_app/animal_service_client.rb +0 -31
- data/example/zoo-app/lib/zoo_app/models/alligator.rb +0 -17
- data/example/zoo-app/spec/pacts/zoo_app-animal_service.json +0 -67
- data/example/zoo-app/spec/service_providers/animal_service_client_spec.rb +0 -71
- data/example/zoo-app/spec/service_providers/pact_helper.rb +0 -15
- data/example/zoo-app/spec/spec_helper.rb +0 -6
- data/scratchpad.rb +0 -52
- data/spec/features/consumption_spec.rb +0 -114
- data/spec/features/production_spec.rb +0 -155
- data/spec/features/provider_states/zebras.rb +0 -28
- data/spec/integration/consumer_async_request_spec.rb +0 -46
- data/spec/integration/consumer_more_than_one_matching_interaction_spec.rb +0 -49
- data/spec/integration/consumer_no_matching_interaction_spec.rb +0 -53
- data/spec/integration/consumer_with_a_provider_state_spec.rb +0 -44
- data/spec/integration/consumer_with_form_hash_spec.rb +0 -62
- data/spec/integration/consumer_with_form_spec.rb +0 -50
- data/spec/integration/consumer_with_params_hash_spec.rb +0 -122
- data/spec/integration/pact/consumer_configuration_spec.rb +0 -66
- data/spec/integration/pact/provider_configuration_spec.rb +0 -25
- data/spec/lib/pact/cli_spec.rb +0 -47
- data/spec/lib/pact/configuration_spec.rb +0 -297
- data/spec/lib/pact/consumer/app_manager_spec.rb +0 -41
- data/spec/lib/pact/consumer/configuration_spec.rb +0 -57
- data/spec/lib/pact/consumer/consumer_contract_builder_spec.rb +0 -69
- data/spec/lib/pact/consumer/interaction_builder_spec.rb +0 -87
- data/spec/lib/pact/consumer/interactions_spec.rb +0 -64
- data/spec/lib/pact/consumer/mock_service/app_spec.rb +0 -52
- data/spec/lib/pact/consumer/mock_service/interaction_list_spec.rb +0 -78
- data/spec/lib/pact/consumer/mock_service/interaction_mismatch_spec.rb +0 -70
- data/spec/lib/pact/consumer/mock_service/interaction_replay_spec.rb +0 -12
- data/spec/lib/pact/consumer/mock_service/rack_request_helper_spec.rb +0 -88
- data/spec/lib/pact/consumer/mock_service/verification_get_spec.rb +0 -142
- data/spec/lib/pact/consumer/service_consumer_spec.rb +0 -11
- data/spec/lib/pact/doc/generator_spec.rb +0 -84
- data/spec/lib/pact/doc/interaction_view_model_spec.rb +0 -132
- data/spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb +0 -29
- data/spec/lib/pact/doc/markdown/index_renderer_spec.rb +0 -29
- data/spec/lib/pact/provider/configuration/configuration_extension_spec.rb +0 -17
- data/spec/lib/pact/provider/configuration/pact_verification_spec.rb +0 -43
- data/spec/lib/pact/provider/configuration/service_provider_config_spec.rb +0 -21
- data/spec/lib/pact/provider/configuration/service_provider_dsl_spec.rb +0 -108
- data/spec/lib/pact/provider/configuration_spec.rb +0 -50
- data/spec/lib/pact/provider/matchers/messages_spec.rb +0 -116
- data/spec/lib/pact/provider/pact_helper_locator_spec.rb +0 -54
- data/spec/lib/pact/provider/print_missing_provider_states_spec.rb +0 -19
- data/spec/lib/pact/provider/request_spec.rb +0 -78
- data/spec/lib/pact/provider/rspec/formatter_rspec_2_spec.rb +0 -68
- data/spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb +0 -72
- data/spec/lib/pact/provider/rspec_spec.rb +0 -55
- data/spec/lib/pact/provider/state/provider_state_manager_spec.rb +0 -89
- data/spec/lib/pact/provider/state/provider_state_proxy_spec.rb +0 -80
- data/spec/lib/pact/provider/state/provider_state_spec.rb +0 -213
- data/spec/lib/pact/provider/world_spec.rb +0 -41
- data/spec/lib/pact/tasks/task_helper_spec.rb +0 -74
- data/spec/lib/pact/tasks/verification_task_spec.rb +0 -75
- data/spec/pact_specification/compliance-1.0.0.rb +0 -47
- data/spec/spec_helper.rb +0 -22
- data/spec/standalone/consumer_fail_test.rb +0 -55
- data/spec/standalone/consumer_pass_test.rb +0 -51
- data/spec/support/a_consumer-a_producer.json +0 -32
- data/spec/support/a_consumer-a_provider.json +0 -32
- data/spec/support/active_support_if_configured.rb +0 -6
- data/spec/support/app_for_config_ru.rb +0 -4
- data/spec/support/case-insensitive-response-header-matching.json +0 -21
- data/spec/support/case-insensitive-response-header-matching.rb +0 -15
- data/spec/support/consumer_contract_template.json +0 -24
- data/spec/support/factories.rb +0 -82
- data/spec/support/generated_index.md +0 -4
- data/spec/support/generated_markdown.md +0 -55
- data/spec/support/interaction_view_model.json +0 -63
- data/spec/support/interaction_view_model_with_terms.json +0 -50
- data/spec/support/markdown_pact.json +0 -48
- data/spec/support/missing_provider_states_output.txt +0 -25
- data/spec/support/options.json +0 -21
- data/spec/support/options_app.rb +0 -15
- data/spec/support/pact_helper.rb +0 -57
- data/spec/support/shared_examples_for_request.rb +0 -94
- data/spec/support/spec_support.rb +0 -20
- data/spec/support/stubbing.json +0 -22
- data/spec/support/stubbing_using_allow.rb +0 -29
- data/spec/support/term.json +0 -48
- data/spec/support/test_app_fail.json +0 -61
- data/spec/support/test_app_pass.json +0 -38
- data/spec/support/test_app_with_right_content_type_differ.json +0 -23
- data/tasks/pact-test.rake +0 -114
- data/tasks/spec.rake +0 -8
Binary file
|
Binary file
|
Binary file
|
@@ -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
|
Binary file
|
@@ -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,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
|
data/example/zoo-app/Gemfile
DELETED
@@ -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
|
data/example/zoo-app/Rakefile
DELETED
@@ -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,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
|
-
}
|