pact-message 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/pact/consumer_contract/message.rb +11 -17
- data/lib/pact/message/consumer/interaction_decorator.rb +2 -2
- data/lib/pact/message/consumer_contract_parser.rb +1 -0
- data/lib/pact/message/version.rb +1 -1
- data/pact-message.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8d37a134b83c10962b37435bf425ce69c8751a6
|
4
|
+
data.tar.gz: e1fce249bfee4a95eee7d40dd1f81048f2c68ab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 382faf25a819b3589a4ffbd2e259e8fcc09341400738d1dea3e03d757d803e02ec83d4ad1ff114fe2f209a09c49734d56c09e633cb1626f9c41ef3ce37ba9496
|
7
|
+
data.tar.gz: 2fe5306302cacaad96d5f257bcfe25f02b018df33dfef4b91fbd23852a44181df5fcb52645471004505e08d84b5485ee90f421b0509d8ec64021d53be36cfb4b
|
data/CHANGELOG.md
CHANGED
@@ -13,11 +13,12 @@ module Pact
|
|
13
13
|
include Pact::ActiveSupportSupport
|
14
14
|
include Pact::SymbolizeKeys
|
15
15
|
|
16
|
-
attr_accessor :description, :contents, :provider_state, :metadata
|
16
|
+
attr_accessor :description, :contents, :provider_state, :provider_states, :metadata
|
17
17
|
|
18
18
|
def initialize attributes = {}
|
19
19
|
@description = attributes[:description]
|
20
20
|
@provider_state = attributes[:provider_state] || attributes[:providerState]
|
21
|
+
@provider_states = attributes[:provider_states] || []
|
21
22
|
@contents = attributes[:contents]
|
22
23
|
@metadata = attributes[:metadata]
|
23
24
|
end
|
@@ -32,9 +33,12 @@ module Pact
|
|
32
33
|
contents = Pact::ConsumerContract::Message::Contents.from_hash(contents_hash)
|
33
34
|
metadata = hash['metaData'] || hash['metadata']
|
34
35
|
provider_state = hash['providerStates'] && hash['providerStates'].first && hash['providerStates'].first['name']
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
provider_states = parse_provider_states(hash['providerStates'])
|
37
|
+
new(symbolize_keys(hash).merge(
|
38
|
+
contents: contents,
|
39
|
+
provider_state: provider_state,
|
40
|
+
provider_states: provider_states,
|
41
|
+
metadata: metadata))
|
38
42
|
end
|
39
43
|
|
40
44
|
def to_hash
|
@@ -116,19 +120,9 @@ module Pact
|
|
116
120
|
|
117
121
|
private
|
118
122
|
|
119
|
-
def self.
|
120
|
-
|
121
|
-
|
122
|
-
Pact.configuration.error_stream.puts("WARN: Using only the first provider state, \"#{provider_state}\", as support for multiple provider states is not yet implemented. Ignoring provider states: #{ignored_list}")
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.warn_if_params_used_in_provider_states(hash)
|
127
|
-
return unless hash['providerStates']
|
128
|
-
provider_states_with_params = hash['providerStates'].select{ | provider_state | provider_state.fetch('params', {}).any? }
|
129
|
-
if provider_states_with_params.any?
|
130
|
-
ignored_list = provider_states_with_params.collect{ |provider_state| "\"#{provider_state['name']}\"" }.join(", ")
|
131
|
-
Pact.configuration.error_stream.puts("WARN: Ignoring params for the following provider states as params support is not yet implemented: #{ignored_list}")
|
123
|
+
def self.parse_provider_states provider_states
|
124
|
+
(provider_states || []).collect do | provider_state_hash |
|
125
|
+
Pact::ProviderState.new(provider_state_hash['name'], provider_state_hash['params'])
|
132
126
|
end
|
133
127
|
end
|
134
128
|
end
|
@@ -14,7 +14,7 @@ module Pact
|
|
14
14
|
|
15
15
|
def as_json options = {}
|
16
16
|
hash = { :description => message.description }
|
17
|
-
hash[:providerStates] = provider_states
|
17
|
+
hash[:providerStates] = provider_states
|
18
18
|
hash[:contents] = extract_contents
|
19
19
|
hash[:matchingRules] = extract_matching_rules
|
20
20
|
hash[:metaData] = message.metadata || {}
|
@@ -38,7 +38,7 @@ module Pact
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def provider_states
|
41
|
-
|
41
|
+
message.provider_states.collect(&:as_json)
|
42
42
|
end
|
43
43
|
|
44
44
|
def extract_matching_rules
|
data/lib/pact/message/version.rb
CHANGED
data/pact-message.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
|
-
spec.add_runtime_dependency "pact-support", "~> 1.
|
32
|
+
spec.add_runtime_dependency "pact-support", "~> 1.8"
|
33
33
|
# pact-mock_service dependencies are Pact::ConsumerContractDecorator
|
34
34
|
# and Pact::ConsumerContractWriter. Potentially we should extract
|
35
35
|
# or duplicate these classes to remove the pact-mock_service dependency.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-message
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Beth Skurrie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pact-support
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pact-mock_service
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|