pact-message 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb08c5946bc8332b709fbe150f0a1bac91dd48ad
4
- data.tar.gz: 4fe6956ee6a15e093e74f2970b953ab4cedaa671
3
+ metadata.gz: ef9df4e508dca614f25914df88e80e1871316975
4
+ data.tar.gz: 93bdc495602316c7b62b0a4b40ec356162f03a60
5
5
  SHA512:
6
- metadata.gz: 5f2b71dea1efceef4f09cd8c89e12ca9f86e18fb4b1ae43dfe93b11cb43a447055fc732ff8baf17a1a01962748f6ebcb1108b3327c4e0d7caffbc5d220eedde9
7
- data.tar.gz: 8d141b680689853b612c6052bb2821d711f5f1b6b5fdde4ac6426427d18dd632f8c55121c7644aec074cb7ffb82657b8ddcff491c6e2d8bd87abb785478dfbdd
6
+ metadata.gz: bb5765686e2fab5838b7a92b6872a231f70d928849f94bc4c397f44a019ef09a41bf0221eddc12c04f591f92ce11a053002e206629ed2874fded5a579d43b35c
7
+ data.tar.gz: 5546f4ae753b1590d8f13efcfe8951b8496bc2e3a647410b1266f285bfad034df6aa17b91ddd0be96c0966576dbaf5e86dd6e1d4db940d4bbb99fd88470b90ef
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ <a name="v0.4.1"></a>
2
+ ### v0.4.1 (2018-04-05)
3
+
4
+
5
+ #### Features
6
+
7
+ * read/write metaData from/to v3 pact files ([7dfcbb9](/../../commit/7dfcbb9))
8
+
9
+
10
+ #### Bug Fixes
11
+
12
+ * locate content matching rules from correct path ([5254c01](/../../commit/5254c01))
13
+
14
+
1
15
  <a name="v0.4.0"></a>
2
16
  ### v0.4.0 (2018-04-03)
3
17
 
@@ -13,12 +13,13 @@ module Pact
13
13
  include Pact::ActiveSupportSupport
14
14
  include Pact::SymbolizeKeys
15
15
 
16
- attr_accessor :description, :content, :provider_state
16
+ attr_accessor :description, :content, :provider_state, :metadata
17
17
 
18
18
  def initialize attributes = {}
19
19
  @description = attributes[:description]
20
20
  @provider_state = attributes[:provider_state] || attributes[:providerState]
21
21
  @content = attributes[:content]
22
+ @metadata = attributes[:metadata]
22
23
  end
23
24
 
24
25
  def self.from_hash hash, options = {}
@@ -26,28 +27,22 @@ module Pact
26
27
  unless opts[:pact_specification_version]
27
28
  opts[:pact_specification_version] = Pact::SpecificationVersion::NIL_VERSION
28
29
  end
29
- content_hash = Pact::MatchingRules.merge(hash['content'], hash['content']['matchingRules'], opts)
30
+ content_matching_rules = hash['matchingRules'] && hash['matchingRules']['body']
31
+ content_hash = Pact::MatchingRules.merge(hash['content'], content_matching_rules, opts)
30
32
  content = Pact::ConsumerContract::Message::Content.from_hash(content_hash)
33
+ metadata = hash['metaData']
31
34
  provider_state = hash['providerStates'] && hash['providerStates'].first && hash['providerStates'].first['name']
32
35
  warn_if_multiple_provider_states(provider_state, hash)
33
36
  warn_if_params_used_in_provider_states(hash)
34
- new(symbolize_keys(hash).merge(content: content, provider_state: provider_state))
37
+ new(symbolize_keys(hash).merge(content: content, provider_state: provider_state, metadata: metadata))
35
38
  end
36
39
 
37
40
  def to_hash
38
41
  {
39
42
  description: description,
40
- provider_state: provider_state,
43
+ provider_states: [{ name: provider_state }],
41
44
  content: content.to_hash,
42
- }
43
- end
44
-
45
- # todo move this proper decorator
46
- def as_json
47
- {
48
- description: description,
49
- providerState: provider_state,
50
- content: content.as_json
45
+ metadata: metadata
51
46
  }
52
47
  end
53
48
 
@@ -56,11 +51,12 @@ module Pact
56
51
  path: '/',
57
52
  method: 'POST',
58
53
  query: nil,
59
- headers: {'Content-Type' => 'application/json'},
54
+ headers: { 'Content-Type' => 'application/json' },
60
55
  body: {
61
56
  description: description,
62
57
  providerStates: [{
63
- name: provider_state
58
+ name: provider_state,
59
+ params: {}
64
60
  }]
65
61
  }
66
62
  )
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Message
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
@@ -1,5 +1,10 @@
1
1
  bundle exec bin/pact-message update '{
2
2
  "description": "a test mesage",
3
+ "providerStates": [
4
+ {
5
+ "name": "an alligator named Mary exists"
6
+ }
7
+ ],
3
8
  "content": {
4
9
  "name": {
5
10
  "contents": "Mary",
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.0
4
+ version: 0.4.1
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-04-03 00:00:00.000000000 Z
11
+ date: 2018-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pact-support