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
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
load 'pact/provider/world.rb'
|
3
|
-
|
4
|
-
describe Pact do
|
5
|
-
describe ".provider_world" do
|
6
|
-
it "returns a world" do
|
7
|
-
expect(Pact.provider_world).to be_instance_of Pact::Provider::World
|
8
|
-
end
|
9
|
-
it "returns the same world each time" do
|
10
|
-
expect(Pact.provider_world).to be Pact.provider_world
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe ".clear_provider_world" do
|
15
|
-
it "clears the world" do
|
16
|
-
original_world = Pact.provider_world
|
17
|
-
Pact.clear_provider_world
|
18
|
-
expect(original_world).to_not be Pact.provider_world
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
module Pact
|
25
|
-
module Provider
|
26
|
-
describe World do
|
27
|
-
|
28
|
-
subject { World.new }
|
29
|
-
describe "provider_states" do
|
30
|
-
it "returns a provider state proxy" do
|
31
|
-
expect(subject.provider_states).to be_instance_of State::ProviderStateProxy
|
32
|
-
end
|
33
|
-
it "returns the same object each time" do
|
34
|
-
expect(subject.provider_states).to be subject.provider_states
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'pact/tasks/task_helper'
|
3
|
-
require 'rake/file_utils'
|
4
|
-
|
5
|
-
module Pact
|
6
|
-
describe TaskHelper do
|
7
|
-
|
8
|
-
|
9
|
-
describe ".execute_pact_verify" do
|
10
|
-
let(:ruby_path) { "/path/to/ruby" }
|
11
|
-
let(:pact_uri) { "/pact/uri" }
|
12
|
-
let(:default_pact_helper_path) { "/pact/helper/path.rb" }
|
13
|
-
|
14
|
-
before do
|
15
|
-
stub_const("FileUtils::RUBY", ruby_path)
|
16
|
-
allow(Pact::Provider::PactHelperLocater).to receive(:pact_helper_path).and_return(default_pact_helper_path)
|
17
|
-
end
|
18
|
-
|
19
|
-
context "with no pact_helper or pact URI" do
|
20
|
-
let(:command) { "SPEC_OPTS='' #{ruby_path} -S pact verify -h #{default_pact_helper_path}" }
|
21
|
-
it "executes the command" do
|
22
|
-
expect(TaskHelper).to receive(:execute_cmd).with(command)
|
23
|
-
TaskHelper.execute_pact_verify
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "with a pact URI" do
|
28
|
-
let(:command) { "SPEC_OPTS='' #{ruby_path} -S pact verify -h #{default_pact_helper_path} -p #{pact_uri}" }
|
29
|
-
it "executes the command" do
|
30
|
-
expect(TaskHelper).to receive(:execute_cmd).with(command)
|
31
|
-
TaskHelper.execute_pact_verify(pact_uri)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "with a pact URI and a pact_helper" do
|
36
|
-
let(:custom_pact_helper_path) { '/custom/pact_helper.rb' }
|
37
|
-
let(:command) { "SPEC_OPTS='' #{ruby_path} -S pact verify -h #{custom_pact_helper_path} -p #{pact_uri}" }
|
38
|
-
it "executes the command" do
|
39
|
-
expect(TaskHelper).to receive(:execute_cmd).with(command)
|
40
|
-
TaskHelper.execute_pact_verify(pact_uri, custom_pact_helper_path)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context "with a pact_helper with no .rb on the end" do
|
45
|
-
let(:custom_pact_helper_path) { '/custom/pact_helper' }
|
46
|
-
let(:command) { "SPEC_OPTS='' #{ruby_path} -S pact verify -h #{custom_pact_helper_path}.rb -p #{pact_uri}" }
|
47
|
-
it "executes the command" do
|
48
|
-
expect(TaskHelper).to receive(:execute_cmd).with(command)
|
49
|
-
TaskHelper.execute_pact_verify(pact_uri, custom_pact_helper_path)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context "with a pact URI and a nil pact_helper" do
|
54
|
-
let(:command) { "SPEC_OPTS='' #{ruby_path} -S pact verify -h #{default_pact_helper_path} -p #{pact_uri}" }
|
55
|
-
it "executes the command" do
|
56
|
-
expect(TaskHelper).to receive(:execute_cmd).with(command)
|
57
|
-
TaskHelper.execute_pact_verify(pact_uri, nil)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "with rspec_opts" do
|
62
|
-
it "includes the rspec_opts as SPEC_OPTS in the command" do
|
63
|
-
expect(TaskHelper).to receive(:execute_cmd) do | command |
|
64
|
-
expect(command).to start_with("SPEC_OPTS=--reporter\\ SomeReporter #{ruby_path}")
|
65
|
-
end
|
66
|
-
TaskHelper.execute_pact_verify(pact_uri, nil, "--reporter SomeReporter")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'pact/tasks/verification_task'
|
3
|
-
|
4
|
-
module Pact
|
5
|
-
describe VerificationTask do
|
6
|
-
before :all do
|
7
|
-
@pact_helper = '/custom/path/pact_helper .rb'
|
8
|
-
@pact_uri = 'http://example.org/pact.json'
|
9
|
-
@task_name = 'pact:verify:pact_rake_spec'
|
10
|
-
@task_name_with_explict_pact_helper = 'pact:verify:pact_rake_spec_with_explict_pact_helper'
|
11
|
-
@consumer = 'some-consumer'
|
12
|
-
@criteria = {:description => /wiffle/}
|
13
|
-
|
14
|
-
VerificationTask.new(:pact_rake_spec_with_explict_pact_helper) do | pact |
|
15
|
-
pact.uri @pact_uri, pact_helper: @pact_helper
|
16
|
-
end
|
17
|
-
|
18
|
-
VerificationTask.new(:pact_rake_spec) do | pact |
|
19
|
-
pact.uri @pact_uri
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
before do
|
24
|
-
allow(Pact::TaskHelper).to receive(:execute_pact_verify).and_return(0)
|
25
|
-
end
|
26
|
-
|
27
|
-
let(:exit_code) {0}
|
28
|
-
|
29
|
-
|
30
|
-
describe '.initialize' do
|
31
|
-
context 'with an explict pact_helper' do
|
32
|
-
it 'creates the tasks' do
|
33
|
-
expect(Rake::Task.tasks).to include_task @task_name
|
34
|
-
end
|
35
|
-
end
|
36
|
-
context 'with no explict pact_helper' do
|
37
|
-
it 'creates the tasks' do
|
38
|
-
expect(Rake::Task.tasks).to include_task @task_name_with_explict_pact_helper
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe 'execute' do
|
44
|
-
|
45
|
-
context "with no explicit pact_helper" do
|
46
|
-
it 'verifies the pacts using the TaskHelper' do
|
47
|
-
expect(Pact::TaskHelper).to receive(:execute_pact_verify).with(@pact_uri, nil, nil)
|
48
|
-
Rake::Task[@task_name].execute
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context "with an explict pact_helper" do
|
53
|
-
let(:verification_config) { [ uri: @pact_uri, pact_helper: @pact_helper] }
|
54
|
-
it 'verifies the pacts using the TaskHelper' do
|
55
|
-
expect(Pact::TaskHelper).to receive(:execute_pact_verify).with(@pact_uri, @pact_helper, nil)
|
56
|
-
Rake::Task[@task_name_with_explict_pact_helper].execute
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'when all specs pass' do
|
61
|
-
|
62
|
-
it 'does not raise an exception' do
|
63
|
-
Rake::Task[@task_name].execute
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
RSpec::Matchers.define :include_task do |expected|
|
72
|
-
match do |actual|
|
73
|
-
actual.any? { |task| task.name == expected }
|
74
|
-
end
|
75
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'pact/consumer/request'
|
3
|
-
require 'pact/consumer_contract/request'
|
4
|
-
|
5
|
-
PACT_SPEC_DIR = "../pact-specification/testcases"
|
6
|
-
REQUEST_TEST_CASE_FOLDERS = Dir.glob("#{PACT_SPEC_DIR}/request/**")
|
7
|
-
REQUEST_TEST_CASE_FILES = Dir.glob("#{PACT_SPEC_DIR}/request/**/*.json")
|
8
|
-
|
9
|
-
TEST_DESCRIPTIONS = {true => "matches", false => "does not match"}
|
10
|
-
|
11
|
-
describe "Pact gem complicance with Pact Specification 1.0.0" do
|
12
|
-
|
13
|
-
directories = Dir.glob("#{PACT_SPEC_DIR}/*")
|
14
|
-
|
15
|
-
directories.each do | dir_name |
|
16
|
-
|
17
|
-
describe File.basename(dir_name) do
|
18
|
-
|
19
|
-
sub_directories = Dir.glob("#{dir_name}/*")
|
20
|
-
|
21
|
-
sub_directories.each do | sub_dir_name |
|
22
|
-
|
23
|
-
context File.basename(sub_dir_name) do
|
24
|
-
testcases = Dir.glob("#{sub_dir_name}/**/*.json")
|
25
|
-
|
26
|
-
testcases.each do | file_name |
|
27
|
-
|
28
|
-
context File.basename(file_name).chomp(".json") do
|
29
|
-
|
30
|
-
file_content = JSON.parse(File.read(file_name))
|
31
|
-
expected = Pact::Request::Expected.from_hash(file_content["expected"])
|
32
|
-
actual = Pact::Consumer::Request::Actual.from_hash(file_content["actual"])
|
33
|
-
expected_result = file_content.fetch("match")
|
34
|
-
comment = file_content["comment"]
|
35
|
-
|
36
|
-
it "#{TEST_DESCRIPTIONS[expected_result]} - #{comment}" do
|
37
|
-
expect(expected.matches?(actual)).to eq expected_result
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'fakefs/spec_helpers'
|
3
|
-
require 'rspec'
|
4
|
-
require 'pact'
|
5
|
-
require 'webmock/rspec'
|
6
|
-
require 'support/factories'
|
7
|
-
require 'support/spec_support'
|
8
|
-
require 'pact/provider/rspec'
|
9
|
-
|
10
|
-
WebMock.disable_net_connect!(allow_localhost: true)
|
11
|
-
|
12
|
-
require './spec/support/active_support_if_configured'
|
13
|
-
|
14
|
-
RSpec.configure do | config |
|
15
|
-
config.include(FakeFS::SpecHelpers, :fakefs => true)
|
16
|
-
|
17
|
-
config.extend Pact::Provider::RSpec::ClassMethods
|
18
|
-
config.include Pact::Provider::RSpec::InstanceMethods
|
19
|
-
config.include Pact::Provider::TestMethods
|
20
|
-
config.include Pact::SpecSupport
|
21
|
-
end
|
22
|
-
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'pact/consumer/rspec'
|
2
|
-
require './spec/support/active_support_if_configured'
|
3
|
-
|
4
|
-
Pact.service_consumer "Standalone Consumer" do
|
5
|
-
has_pact_with "Standalone Provider" do
|
6
|
-
mock_service :standalone_service do
|
7
|
-
port 1238
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class StandaloneClient
|
13
|
-
|
14
|
-
def initialize base_url
|
15
|
-
@base_url = base_url
|
16
|
-
end
|
17
|
-
|
18
|
-
def call
|
19
|
-
uri = URI("#{@base_url}/something")
|
20
|
-
post_req = Net::HTTP::Post.new(uri.path)
|
21
|
-
post_req['Content-Type'] = "application/json"
|
22
|
-
post_req.body = {a: "not matching body"}.to_json
|
23
|
-
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
24
|
-
http.request post_req
|
25
|
-
end
|
26
|
-
JSON.parse(response.body)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
describe StandaloneClient, pact: true do
|
32
|
-
|
33
|
-
subject { StandaloneClient.new("http://localhost:1238") }
|
34
|
-
|
35
|
-
describe "call" do
|
36
|
-
|
37
|
-
let(:expected_body) { {a: "body"} }
|
38
|
-
let(:expected_headers) { {'Content-Type' => "application/hal+json"} }
|
39
|
-
|
40
|
-
before do
|
41
|
-
standalone_service.
|
42
|
-
upon_receiving("a request to create something").with(method: 'post', path: '/something', headers: expected_headers, body: expected_body).
|
43
|
-
will_respond_with(status: 200, headers: {}, body: {a: 'response body'})
|
44
|
-
|
45
|
-
standalone_service.
|
46
|
-
upon_receiving("a request to create something else").with(method: 'post', path: '/something-else', headers: expected_headers, body: expected_body).
|
47
|
-
will_respond_with(status: 200, headers: {}, body: {a: 'response body'})
|
48
|
-
end
|
49
|
-
|
50
|
-
it "will fail and display a helpful message" do
|
51
|
-
subject.call
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'pact/consumer/rspec'
|
2
|
-
require './spec/support/active_support_if_configured'
|
3
|
-
|
4
|
-
Pact.service_consumer "Standalone Consumer" do
|
5
|
-
has_pact_with "Standalone Provider" do
|
6
|
-
mock_service :standalone_service do
|
7
|
-
port 1237
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class StandaloneClient
|
13
|
-
|
14
|
-
def initialize base_url
|
15
|
-
@base_url = base_url
|
16
|
-
end
|
17
|
-
|
18
|
-
def call
|
19
|
-
uri = URI("#{@base_url}/something")
|
20
|
-
post_req = Net::HTTP::Post.new(uri.path)
|
21
|
-
post_req['Content-Type'] = "application/json"
|
22
|
-
post_req.body = {a: "body"}.to_json
|
23
|
-
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
24
|
-
http.request post_req
|
25
|
-
end
|
26
|
-
response.body
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
describe StandaloneClient, pact: true do
|
32
|
-
|
33
|
-
subject { StandaloneClient.new("http://localhost:1237") }
|
34
|
-
|
35
|
-
describe "call" do
|
36
|
-
|
37
|
-
let(:expected_body) { {a: "body"} }
|
38
|
-
let(:response_body) { {a: 'response body'} }
|
39
|
-
|
40
|
-
before do
|
41
|
-
standalone_service.
|
42
|
-
upon_receiving("a request to create something").with(method: 'post', path: '/something', body: expected_body).
|
43
|
-
will_respond_with(status: 200, headers: {}, body: response_body)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "will pass" do
|
47
|
-
expect(subject.call).to eq response_body.to_json
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"producer": {
|
3
|
-
"name": "an old producer"
|
4
|
-
},
|
5
|
-
"consumer": {
|
6
|
-
"name": "a consumer"
|
7
|
-
},
|
8
|
-
"interactions": [
|
9
|
-
{
|
10
|
-
"description": "request one",
|
11
|
-
"request": {
|
12
|
-
"method": "get",
|
13
|
-
"path": "/path_one"
|
14
|
-
},
|
15
|
-
"response": {
|
16
|
-
},
|
17
|
-
"producer_state": "state one"
|
18
|
-
},
|
19
|
-
{
|
20
|
-
"description": "request two",
|
21
|
-
"request": {
|
22
|
-
"method": "get",
|
23
|
-
"path": "/path_two"
|
24
|
-
},
|
25
|
-
"response": {
|
26
|
-
}
|
27
|
-
}
|
28
|
-
],
|
29
|
-
"metadata": {
|
30
|
-
"pactSpecificationVersion": "1.0"
|
31
|
-
}
|
32
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"provider": {
|
3
|
-
"name": "a provider"
|
4
|
-
},
|
5
|
-
"consumer": {
|
6
|
-
"name": "a consumer"
|
7
|
-
},
|
8
|
-
"interactions": [
|
9
|
-
{
|
10
|
-
"description": "request one",
|
11
|
-
"request": {
|
12
|
-
"method": "get",
|
13
|
-
"path": "/path_one"
|
14
|
-
},
|
15
|
-
"response": {
|
16
|
-
},
|
17
|
-
"provider_state": "state one"
|
18
|
-
},
|
19
|
-
{
|
20
|
-
"description": "request two",
|
21
|
-
"request": {
|
22
|
-
"method": "get",
|
23
|
-
"path": "/path_two"
|
24
|
-
},
|
25
|
-
"response": {
|
26
|
-
}
|
27
|
-
}
|
28
|
-
],
|
29
|
-
"metadata": {
|
30
|
-
"pactSpecificationVersion": "1.0"
|
31
|
-
}
|
32
|
-
}
|