pact-messages 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/Dockerfile +17 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +111 -0
- data/Jenkinsfile +1 -0
- data/README.md +2 -0
- data/Rakefile +7 -3
- data/app.yaml +15 -0
- data/example/user-app/Gemfile +6 -5
- data/example/user-app/Gemfile.lock +18 -20
- data/example/user-app/Rakefile +2 -2
- data/example/user-app/lib/user_app/message_builder.rb +3 -3
- data/example/user-app/lib/user_app/message_processor.rb +1 -1
- data/example/user-app/lib/user_app/version.rb +1 -1
- data/example/user-app/log/pact.log +1 -0
- data/example/user-app/spec/pact_helper.rb +15 -15
- data/example/user-app/spec/service_consumers/message_processor_spec.rb +6 -6
- data/example/user-app/spec/service_providers/message_builder_spec.rb +9 -9
- data/example/user-app/spec/spec_helper.rb +2 -2
- data/lib/pact/messages.rb +4 -3
- data/lib/pact/messages/consumer.rb +6 -6
- data/lib/pact/messages/consumer/contract_builder.rb +6 -6
- data/lib/pact/messages/consumer/dsl.rb +4 -4
- data/lib/pact/messages/consumer/dsl/message_consumer.rb +1 -1
- data/lib/pact/messages/consumer/interaction.rb +1 -1
- data/lib/pact/messages/consumer/interaction_builder.rb +7 -2
- data/lib/pact/messages/consumer/world.rb +2 -2
- data/lib/pact/messages/message_finder.rb +6 -6
- data/lib/pact/messages/version.rb +1 -1
- data/pact-messages.gemspec +17 -17
- metadata +55 -9
- data/.travis.yml +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f7f7332ecdf6cca64e188cb71296aeef88218eb
|
4
|
+
data.tar.gz: 2b895337383dffdf3a77f9bb2c4c66e330b81adf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 636e3c2488e7e40bdcefd6b775334f2f927798d18ab3cb2b3dcba91b06272970746558eefb991d9c8d5b58be9ccbcce656ef0516fd0f7fe65752f82a80dcf7d3
|
7
|
+
data.tar.gz: e42de126aa7789c701e2c26aaa1d66e3dc0a5da813006b08248c80f6f62e8b68513e05bbbdd63b22132fe29dfb1cddf8e81098ed51f31e27377970d2536174b6
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.3
|
data/Dockerfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
FROM quay.io/assemblyline/alpine:3.6 as dev
|
2
|
+
|
3
|
+
ENV APP_NAME=pact-messages \
|
4
|
+
BUNDLE_SILENCE_ROOT_WARNING=1
|
5
|
+
|
6
|
+
WORKDIR /app/
|
7
|
+
|
8
|
+
COPY .ruby-version ./
|
9
|
+
RUN apk add --no-cache \
|
10
|
+
ca-certificates \
|
11
|
+
git \
|
12
|
+
build-base \
|
13
|
+
ruby$(cat .ruby-version) \
|
14
|
+
ruby$(cat .ruby-version)-dev
|
15
|
+
COPY Gemfile Gemfile.lock pact-messages.gemspec ./
|
16
|
+
RUN bundle install -j4 -r3
|
17
|
+
COPY . .
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pact-messages (0.2.0)
|
5
|
+
pact (~> 1.9)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
awesome_print (1.8.0)
|
12
|
+
bundler-audit (0.6.0)
|
13
|
+
bundler (~> 1.2)
|
14
|
+
thor (~> 0.18)
|
15
|
+
coderay (1.1.2)
|
16
|
+
diff-lcs (1.3)
|
17
|
+
find_a_port (1.0.1)
|
18
|
+
json (2.1.0)
|
19
|
+
method_source (0.9.0)
|
20
|
+
pact (1.20.1)
|
21
|
+
json (> 1.8.5)
|
22
|
+
pact-mock_service (~> 2.0)
|
23
|
+
pact-support (~> 1.2, >= 1.2.4)
|
24
|
+
rack-test (~> 0.6, >= 0.6.3)
|
25
|
+
randexp (~> 0.1.7)
|
26
|
+
rspec (>= 2.14)
|
27
|
+
term-ansicolor (~> 1.0)
|
28
|
+
thor
|
29
|
+
webrick
|
30
|
+
pact-mock_service (2.1.0)
|
31
|
+
find_a_port (~> 1.0.1)
|
32
|
+
json
|
33
|
+
pact-support (~> 1.0)
|
34
|
+
rack
|
35
|
+
rack-test (~> 0.6.2)
|
36
|
+
rspec (>= 2.14)
|
37
|
+
term-ansicolor (~> 1.0)
|
38
|
+
thor
|
39
|
+
webrick
|
40
|
+
pact-support (1.2.4)
|
41
|
+
awesome_print (~> 1.1)
|
42
|
+
find_a_port (~> 1.0.1)
|
43
|
+
json
|
44
|
+
randexp (~> 0.1.7)
|
45
|
+
rspec (>= 2.14)
|
46
|
+
term-ansicolor (~> 1.0)
|
47
|
+
thor
|
48
|
+
parallel (1.12.1)
|
49
|
+
parser (2.4.0.2)
|
50
|
+
ast (~> 2.3)
|
51
|
+
powerpack (0.1.1)
|
52
|
+
pry (0.11.3)
|
53
|
+
coderay (~> 1.1.0)
|
54
|
+
method_source (~> 0.9.0)
|
55
|
+
rack (1.6.8)
|
56
|
+
rack-test (0.6.3)
|
57
|
+
rack (>= 1.0)
|
58
|
+
rainbow (2.2.2)
|
59
|
+
rake
|
60
|
+
rake (10.5.0)
|
61
|
+
randexp (0.1.7)
|
62
|
+
reevoocop (0.0.12)
|
63
|
+
rubocop (= 0.49.1)
|
64
|
+
rspec (3.7.0)
|
65
|
+
rspec-core (~> 3.7.0)
|
66
|
+
rspec-expectations (~> 3.7.0)
|
67
|
+
rspec-mocks (~> 3.7.0)
|
68
|
+
rspec-core (3.7.1)
|
69
|
+
rspec-support (~> 3.7.0)
|
70
|
+
rspec-expectations (3.7.0)
|
71
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
+
rspec-support (~> 3.7.0)
|
73
|
+
rspec-mocks (3.7.0)
|
74
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
+
rspec-support (~> 3.7.0)
|
76
|
+
rspec-support (3.7.1)
|
77
|
+
rspec_junit_formatter (0.3.0)
|
78
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
79
|
+
rubocop (0.49.1)
|
80
|
+
parallel (~> 1.10)
|
81
|
+
parser (>= 2.3.3.1, < 3.0)
|
82
|
+
powerpack (~> 0.1)
|
83
|
+
rainbow (>= 1.99.1, < 3.0)
|
84
|
+
ruby-progressbar (~> 1.7)
|
85
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
86
|
+
ruby-progressbar (1.9.0)
|
87
|
+
ruby_audit (1.2.0)
|
88
|
+
bundler-audit (~> 0.6.0)
|
89
|
+
term-ansicolor (1.6.0)
|
90
|
+
tins (~> 1.0)
|
91
|
+
thor (0.20.0)
|
92
|
+
tins (1.16.3)
|
93
|
+
unicode-display_width (1.3.0)
|
94
|
+
webrick (1.4.2)
|
95
|
+
|
96
|
+
PLATFORMS
|
97
|
+
ruby
|
98
|
+
|
99
|
+
DEPENDENCIES
|
100
|
+
bundler (~> 1.2)
|
101
|
+
pact-messages!
|
102
|
+
pry (~> 0.10)
|
103
|
+
rack (~> 1.6)
|
104
|
+
rake (~> 10.0)
|
105
|
+
reevoocop (~> 0.0.12)
|
106
|
+
rspec (~> 3.3)
|
107
|
+
rspec_junit_formatter
|
108
|
+
ruby_audit (~> 1.2)
|
109
|
+
|
110
|
+
BUNDLED WITH
|
111
|
+
1.16.1
|
data/Jenkinsfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
reevooApp()
|
data/README.md
CHANGED
@@ -74,6 +74,7 @@ Pact::Messages.pact_broker_url = 'http://my-pact-broker'
|
|
74
74
|
```ruby
|
75
75
|
Pact::Messages.build_mock_service(:message_provider_service) do |service|
|
76
76
|
service.given('User subscribed')
|
77
|
+
.description('a request for subscribed user')
|
77
78
|
.provide(
|
78
79
|
{
|
79
80
|
'first_name' => like('John'),
|
@@ -94,6 +95,7 @@ end
|
|
94
95
|
```
|
95
96
|
|
96
97
|
PS: '.given' is optional, if you have only one state, you don't need to specify '.given'
|
98
|
+
'.description' is optional
|
97
99
|
|
98
100
|
```ruby
|
99
101
|
Pact::Messages.build_mock_service(:message_provider_service) do |service|
|
data/Rakefile
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require "reevoocop/rake_task"
|
4
|
+
require "bundler/audit/task"
|
3
5
|
|
6
|
+
ReevooCop::RakeTask.new(:reevoocop)
|
4
7
|
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
Bundler::Audit::Task.new
|
5
9
|
|
6
|
-
task default: :
|
10
|
+
task default: %w(spec reevoocop bundle:audit)
|
data/app.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
name: pact-messages
|
2
|
+
|
3
|
+
image:
|
4
|
+
repository: quay.io/reevoo/pact-messages
|
5
|
+
|
6
|
+
pipeline:
|
7
|
+
tests:
|
8
|
+
rspec:
|
9
|
+
script: rspec
|
10
|
+
reevoocop:
|
11
|
+
script: reevoocop
|
12
|
+
audit:
|
13
|
+
script: |
|
14
|
+
bundle exec bundle-audit check --update
|
15
|
+
bundle exec ruby-audit check
|
data/example/user-app/Gemfile
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
group :development, :test do
|
4
|
-
gem
|
5
|
-
gem
|
6
|
-
gem
|
4
|
+
gem "pact-messages", path: "../../"
|
5
|
+
gem "pry"
|
6
|
+
gem "rspec"
|
7
7
|
end
|
8
8
|
|
9
|
-
gem
|
9
|
+
gem "rack", "~>1.6"
|
10
|
+
gem "rake"
|
@@ -1,45 +1,42 @@
|
|
1
1
|
PATH
|
2
|
-
remote:
|
2
|
+
remote: ../..
|
3
3
|
specs:
|
4
|
-
pact-messages (0.
|
4
|
+
pact-messages (0.2.0)
|
5
5
|
pact (~> 1.9)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
awesome_print (1.
|
10
|
+
awesome_print (1.8.0)
|
11
11
|
coderay (1.0.9)
|
12
12
|
diff-lcs (1.2.4)
|
13
13
|
find_a_port (1.0.1)
|
14
|
-
json (1.
|
14
|
+
json (2.1.0)
|
15
15
|
method_source (0.8.2)
|
16
|
-
pact (1.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
pact-support (~> 0.5)
|
22
|
-
rack-test (~> 0.6.2)
|
16
|
+
pact (1.20.1)
|
17
|
+
json (> 1.8.5)
|
18
|
+
pact-mock_service (~> 2.0)
|
19
|
+
pact-support (~> 1.2, >= 1.2.4)
|
20
|
+
rack-test (~> 0.6, >= 0.6.3)
|
23
21
|
randexp (~> 0.1.7)
|
24
22
|
rspec (>= 2.14)
|
25
23
|
term-ansicolor (~> 1.0)
|
26
24
|
thor
|
27
25
|
webrick
|
28
|
-
pact-mock_service (
|
26
|
+
pact-mock_service (2.1.0)
|
29
27
|
find_a_port (~> 1.0.1)
|
30
28
|
json
|
31
|
-
pact-support (~> 0
|
29
|
+
pact-support (~> 1.0)
|
32
30
|
rack
|
33
31
|
rack-test (~> 0.6.2)
|
34
32
|
rspec (>= 2.14)
|
35
33
|
term-ansicolor (~> 1.0)
|
36
34
|
thor
|
37
35
|
webrick
|
38
|
-
pact-support (
|
36
|
+
pact-support (1.2.4)
|
39
37
|
awesome_print (~> 1.1)
|
40
38
|
find_a_port (~> 1.0.1)
|
41
39
|
json
|
42
|
-
rack-test (~> 0.6.2)
|
43
40
|
randexp (~> 0.1.7)
|
44
41
|
rspec (>= 2.14)
|
45
42
|
term-ansicolor (~> 1.0)
|
@@ -62,11 +59,11 @@ GEM
|
|
62
59
|
diff-lcs (>= 1.1.3, < 2.0)
|
63
60
|
rspec-mocks (2.14.3)
|
64
61
|
slop (3.4.6)
|
65
|
-
term-ansicolor (1.
|
62
|
+
term-ansicolor (1.6.0)
|
66
63
|
tins (~> 1.0)
|
67
|
-
thor (0.
|
68
|
-
tins (1.
|
69
|
-
webrick (1.
|
64
|
+
thor (0.20.0)
|
65
|
+
tins (1.16.3)
|
66
|
+
webrick (1.4.2)
|
70
67
|
|
71
68
|
PLATFORMS
|
72
69
|
ruby
|
@@ -74,8 +71,9 @@ PLATFORMS
|
|
74
71
|
DEPENDENCIES
|
75
72
|
pact-messages!
|
76
73
|
pry
|
74
|
+
rack (~> 1.6)
|
77
75
|
rake
|
78
76
|
rspec
|
79
77
|
|
80
78
|
BUNDLED WITH
|
81
|
-
1.
|
79
|
+
1.16.1
|
data/example/user-app/Rakefile
CHANGED
@@ -3,9 +3,9 @@ module UserApp
|
|
3
3
|
module MessageBuilder
|
4
4
|
def self.build(subscribed)
|
5
5
|
{
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
"first_name" => "William",
|
7
|
+
"last_name" => "Taylor",
|
8
|
+
"subscribed" => subscribed,
|
9
9
|
}
|
10
10
|
end
|
11
11
|
end
|
@@ -2,3 +2,4 @@
|
|
2
2
|
I, [2015-11-05T15:43:21.302165 #91013] INFO -- : Writing pact for Message Provider to /Users/alexmalkov/reevoo/pact-messages/example/user-app/spec/pacts/message_consumer-message_provider.json
|
3
3
|
I, [2015-11-05T15:43:55.291312 #91081] INFO -- : Writing pact for Message Provider to /Users/alexmalkov/reevoo/pact-messages/example/user-app/spec/pacts/message_consumer-message_provider.json
|
4
4
|
I, [2015-11-05T16:21:19.348693 #97073] INFO -- : Writing pact for Message Provider to /Users/alexmalkov/reevoo/pact-messages/example/user-app/spec/pacts/message_consumer-message_provider.json
|
5
|
+
I, [2017-02-09T09:01:20.361942 #2703] INFO -- : Writing pact for Message Provider to /home/surya/pact-messages/example/user-app/spec/pacts/message_consumer-message_provider.json
|
@@ -1,24 +1,24 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
1
|
+
require_relative "spec_helper"
|
2
|
+
require "pact/messages"
|
3
3
|
|
4
|
-
Pact::Messages.service_consumer
|
5
|
-
has_pact_with
|
6
|
-
mock_service
|
4
|
+
Pact::Messages.service_consumer "Message Consumer" do
|
5
|
+
has_pact_with "Message Provider" do
|
6
|
+
mock_service "message_provider_service"
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
Pact::Messages.build_mock_service(:message_provider_service) do |service|
|
11
|
-
service.given(
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
service.given("User subscribed")
|
12
|
+
.provide(
|
13
|
+
"first_name" => like("John"),
|
14
|
+
"last_name" => like("Smith"),
|
15
|
+
"subscribed" => true,
|
16
16
|
)
|
17
17
|
|
18
|
-
service.given(
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
service.given("User unsubscribed")
|
19
|
+
.provide(
|
20
|
+
"first_name" => like("John"),
|
21
|
+
"last_name" => like("Smith"),
|
22
|
+
"subscribed" => false,
|
23
23
|
)
|
24
24
|
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
1
|
+
require_relative "../pact_helper"
|
2
|
+
require "user_app/message_processor"
|
3
3
|
|
4
4
|
module UserApp
|
5
5
|
describe MessageProcessor, pact: true do
|
6
6
|
let(:message) do
|
7
|
-
Pact::Messages.get_message_sample(
|
7
|
+
Pact::Messages.get_message_sample("Message Provider", "Message Consumer", "User subscribed")
|
8
8
|
end
|
9
9
|
|
10
|
-
describe
|
11
|
-
it
|
12
|
-
expect(described_class.full_name(message)).to eq(
|
10
|
+
describe ".full_name" do
|
11
|
+
it "joins first name and last name" do
|
12
|
+
expect(described_class.full_name(message)).to eq("John Smith")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,31 +1,31 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
1
|
+
require_relative "../pact_helper"
|
2
|
+
require "user_app/message_builder"
|
3
3
|
|
4
4
|
module UserApp
|
5
5
|
describe MessageBuilder, pact: true do
|
6
6
|
subject { described_class.build(subscribed_status) }
|
7
7
|
|
8
|
-
describe
|
9
|
-
context
|
8
|
+
describe ".build" do
|
9
|
+
context "subscribed" do
|
10
10
|
let(:subscribed_status) { true }
|
11
11
|
let(:user_contract) do
|
12
|
-
Pact::Messages.get_message_contract(
|
12
|
+
Pact::Messages.get_message_contract("Message Provider", "Message Consumer", "User subscribed")
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
15
|
+
it "matches the contract" do
|
16
16
|
diff = Pact::JsonDiffer.call(user_contract, subject)
|
17
17
|
puts Pact::Matchers::UnixDiffFormatter.call(diff) if diff.any? # Print a pretty diff if we fail
|
18
18
|
expect(diff).to be_empty
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
context
|
22
|
+
context "unsubscribed" do
|
23
23
|
let(:subscribed_status) { false }
|
24
24
|
let(:user_contract) do
|
25
|
-
Pact::Messages.get_message_contract(
|
25
|
+
Pact::Messages.get_message_contract("Message Provider", "Message Consumer", "User unsubscribed")
|
26
26
|
end
|
27
27
|
|
28
|
-
it
|
28
|
+
it "matches the contract" do
|
29
29
|
diff = Pact::JsonDiffer.call(user_contract, subject)
|
30
30
|
puts Pact::Matchers::UnixDiffFormatter.call(diff) if diff.any? # Print a pretty diff if we fail
|
31
31
|
expect(diff).to be_empty
|
data/lib/pact/messages.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative
|
2
|
-
require_relative
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
1
|
+
require_relative "consumer/contract_builder"
|
2
|
+
require_relative "consumer/interaction"
|
3
|
+
require_relative "consumer/interaction_builder"
|
4
|
+
require_relative "consumer/mock_service_factory"
|
5
|
+
require_relative "consumer/world"
|
6
|
+
require_relative "consumer/dsl"
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
1
|
+
require "uri"
|
2
|
+
require "json/add/regexp"
|
3
|
+
require "pact/logging"
|
4
|
+
require "pact/consumer_contract"
|
5
|
+
require "pact/mock_service/client"
|
6
|
+
require "pact/consumer_contract/consumer_contract_writer"
|
7
7
|
|
8
8
|
module Pact
|
9
9
|
module Messages
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require_relative
|
3
|
-
require_relative
|
4
|
-
require_relative
|
1
|
+
require "pact/shared/dsl"
|
2
|
+
require_relative "dsl/message_consumer"
|
3
|
+
require_relative "dsl/message_provider"
|
4
|
+
require_relative "dsl/mock_service"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "net/http"
|
2
2
|
|
3
3
|
module Pact
|
4
4
|
module Messages
|
@@ -8,7 +8,7 @@ module Pact
|
|
8
8
|
|
9
9
|
def initialize(&block)
|
10
10
|
@interaction = Pact::Messages::Consumer::Interaction.new
|
11
|
-
@interaction.request = Pact::Request::Expected.from_hash(method:
|
11
|
+
@interaction.request = Pact::Request::Expected.from_hash(method: "MESSAGE", path: "/")
|
12
12
|
@callback = block
|
13
13
|
end
|
14
14
|
|
@@ -21,6 +21,11 @@ module Pact
|
|
21
21
|
interaction.response = Pact::Response.new(body: response)
|
22
22
|
@callback.call interaction
|
23
23
|
end
|
24
|
+
|
25
|
+
def description(description)
|
26
|
+
interaction.description = description.nil? ? "" : description.to_s
|
27
|
+
self
|
28
|
+
end
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
@@ -18,7 +18,7 @@ module Pact
|
|
18
18
|
attr_reader :mock_services
|
19
19
|
|
20
20
|
def initialize
|
21
|
-
@mock_services
|
21
|
+
@mock_services = {}
|
22
22
|
end
|
23
23
|
|
24
24
|
def register_mock_service(mock_service_name, contract_builder)
|
@@ -33,7 +33,7 @@ module Pact
|
|
33
33
|
contract_builder = mock_services.values.find do |builder|
|
34
34
|
builder.provider_name == provider_name && builder.consumer_name == consumer_name
|
35
35
|
end
|
36
|
-
contract_builder
|
36
|
+
contract_builder&.consumer_contract
|
37
37
|
end
|
38
38
|
|
39
39
|
end
|
@@ -1,20 +1,20 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
require "pact"
|
4
4
|
|
5
5
|
module Pact
|
6
6
|
module Messages
|
7
7
|
module MessageFinder
|
8
|
-
|
8
|
+
@pact_broker_url = "http://pact-broker"
|
9
9
|
|
10
10
|
module_function
|
11
11
|
|
12
12
|
def pact_broker_url
|
13
|
-
|
13
|
+
@pact_broker_url
|
14
14
|
end
|
15
15
|
|
16
16
|
def pact_broker_url=(url)
|
17
|
-
|
17
|
+
@pact_broker_url = url
|
18
18
|
end
|
19
19
|
|
20
20
|
def get_message_contract(provider_name, consumer_name, provider_state = nil, contract_uri = nil)
|
data/pact-messages.gemspec
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'pact/messages/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
-
spec.version =
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
4
|
+
spec.name = "pact-messages"
|
5
|
+
spec.version = "0.2.0"
|
6
|
+
spec.authors = ["Alex Malkov", "David Sevcik"]
|
7
|
+
spec.email = ["alex.a.malkov@gmail.com", "david.sevcik@reevoo.com"]
|
11
8
|
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.summary = "Enables consumer driven contract testing for asynchronous message driven systems."
|
10
|
+
spec.homepage = "https://github.com/reevoo/pact-messages"
|
11
|
+
spec.license = "MIT"
|
15
12
|
|
16
13
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/^(test|spec|features)\//) }
|
17
|
-
spec.require_paths = [
|
14
|
+
spec.require_paths = ["lib"]
|
18
15
|
|
19
|
-
spec.add_runtime_dependency
|
16
|
+
spec.add_runtime_dependency "pact", "~> 1.9"
|
20
17
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
18
|
+
spec.add_development_dependency "bundler", "~> 1.2"
|
19
|
+
spec.add_development_dependency "rack", "~> 1.6"
|
20
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
+
spec.add_development_dependency "rspec", "~> 3.3"
|
22
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
23
|
+
spec.add_development_dependency "reevoocop", "~> 0.0.12"
|
24
|
+
spec.add_development_dependency "ruby_audit", "~> 1.2"
|
25
|
+
spec.add_development_dependency "rspec_junit_formatter"
|
26
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-messages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Malkov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pact
|
@@ -31,14 +31,28 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '1.
|
34
|
+
version: '1.2'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '1.
|
41
|
+
version: '1.2'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rack
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.6'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.6'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: rake
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,19 +96,47 @@ dependencies:
|
|
82
96
|
- !ruby/object:Gem::Version
|
83
97
|
version: '0.10'
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
99
|
+
name: reevoocop
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
87
101
|
requirements:
|
88
102
|
- - "~>"
|
89
103
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
104
|
+
version: 0.0.12
|
91
105
|
type: :development
|
92
106
|
prerelease: false
|
93
107
|
version_requirements: !ruby/object:Gem::Requirement
|
94
108
|
requirements:
|
95
109
|
- - "~>"
|
96
110
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
111
|
+
version: 0.0.12
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: ruby_audit
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '1.2'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '1.2'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rspec_junit_formatter
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
98
140
|
description:
|
99
141
|
email:
|
100
142
|
- alex.a.malkov@gmail.com
|
@@ -106,12 +148,16 @@ files:
|
|
106
148
|
- ".gitignore"
|
107
149
|
- ".rspec"
|
108
150
|
- ".rubocop.yml"
|
109
|
-
- ".
|
151
|
+
- ".ruby-version"
|
110
152
|
- CODE_OF_CONDUCT.md
|
153
|
+
- Dockerfile
|
111
154
|
- Gemfile
|
155
|
+
- Gemfile.lock
|
156
|
+
- Jenkinsfile
|
112
157
|
- LICENSE.txt
|
113
158
|
- README.md
|
114
159
|
- Rakefile
|
160
|
+
- app.yaml
|
115
161
|
- example/user-app/Gemfile
|
116
162
|
- example/user-app/Gemfile.lock
|
117
163
|
- example/user-app/README.md
|
@@ -159,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
205
|
version: '0'
|
160
206
|
requirements: []
|
161
207
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.
|
208
|
+
rubygems_version: 2.6.14
|
163
209
|
signing_key:
|
164
210
|
specification_version: 4
|
165
211
|
summary: Enables consumer driven contract testing for asynchronous message driven
|
data/.travis.yml
DELETED