pact-mock_service 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de67c3aa131cccf2035d9d24be56968b9f942be3
4
- data.tar.gz: c741a83e177cbe124ffe3c83c01b8ddac950883b
3
+ metadata.gz: 878a7bdcbd07da354857adfe0eaead4f7a7df91b
4
+ data.tar.gz: ecea144926461df7936678c54dd44a8aa84f97c8
5
5
  SHA512:
6
- metadata.gz: 15d4b2f7c9c6692cc482a5159805278d62127e8676fa1db6d6fb174b6317fadd126cd39513e94b600d21915771d2adf4b6c11f868cebe5d23516d4a6844c948e
7
- data.tar.gz: 9854ecc116422877812ce15ff1d337981db5fd6ba32b7381a09bcf9cd34a0231adeb08c7a82d427d30deb17ca7cfe0e8d410f2931d09957b52c24079766bf095
6
+ metadata.gz: 3112599095c361f9e20b9d448761c8125cdc83007b002c55f0eeec871342d0bb6cffd775d3fca69e103c202ce88c5e91dac2ff25fa1b2ba22c76f769661c79dd
7
+ data.tar.gz: d2bac546292fb47abdc7bac62355b10296b2ea53a778df02422df7cc48931c3fa1caf7001a2917e68225853418dad3e1ff48f99b8a099f3c7299dcb18c5aea31
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@ Do this to generate your change history
2
2
 
3
3
  git log --pretty=format:' * %h - %s (%an, %ad)' vX.Y.Z..HEAD
4
4
 
5
+ ### 2.0.1 (11 May 2017)
6
+ * 2c106b9 - Fix serialisation of request in pact for pact spec 2. (Beth Skurrie, Thu May 11 09:32:43 2017 +1000)
7
+
5
8
  ### 2.0.0 (12 Apr 2017)
6
9
  * 74bd80e - Bumping pact-support version to ~> 1.0 (Beth Skurrie, Wed Apr 12 15:10:49 2017 +1000)
7
10
 
@@ -13,6 +13,15 @@ module Pact
13
13
  end
14
14
 
15
15
  def as_json options = {}
16
+ hash = to_hash_without_rules
17
+ include_matching_rules? ? with_matching_rules(hash) : hash
18
+ end
19
+
20
+ private
21
+
22
+ attr_reader :request
23
+
24
+ def to_hash_without_rules
16
25
  hash = {
17
26
  method: request.method,
18
27
  path: path
@@ -20,40 +29,19 @@ module Pact
20
29
  hash[:query] = query if request.specified?(:query)
21
30
  hash[:headers] = headers if request.specified?(:headers)
22
31
  hash[:body] = body if request.specified?(:body)
23
- include_matching_rules? ? with_matching_rules(hash) : hash
32
+ hash
24
33
  end
25
34
 
26
- private
27
-
28
- attr_reader :request
29
-
30
35
  def path
31
- if include_matching_rules?
32
- request.path
33
- else
34
- Pact::Reification.from_term(request.path)
35
- end
36
+ Pact::Reification.from_term(request.path)
36
37
  end
37
38
 
38
39
  def query
39
- if include_matching_rules?
40
- request.query.query.each do | key, val |
41
- if val.length == 1
42
- request.query.query[key] = val[0]
43
- end
44
- end
45
- request.query.query
46
- else
47
- Pact::Reification.from_term(request.query)
48
- end
40
+ Pact::Reification.from_term(request.query)
49
41
  end
50
42
 
51
43
  def headers
52
- if include_matching_rules?
53
- request.headers
54
- else
55
- Pact::Reification.from_term(request.headers)
56
- end
44
+ Pact::Reification.from_term(request.headers)
57
45
  end
58
46
 
59
47
  # This feels wrong to be checking the class type of the body
@@ -62,11 +50,7 @@ module Pact
62
50
  if content_type_is_form && request.body.is_a?(Hash)
63
51
  URI.encode_www_form convert_hash_body_to_array_of_arrays
64
52
  else
65
- if include_matching_rules?
66
- request.body
67
- else
68
- Pact::Reification.from_term(request.body)
69
- end
53
+ Pact::Reification.from_term(request.body)
70
54
  end
71
55
  end
72
56
 
@@ -83,11 +67,7 @@ module Pact
83
67
  end
84
68
  end
85
69
 
86
- if include_matching_rules?
87
- arrays
88
- else
89
- Pact::Reification.from_term(arrays)
90
- end
70
+ Pact::Reification.from_term(arrays)
91
71
  end
92
72
 
93
73
  def include_matching_rules?
@@ -95,10 +75,9 @@ module Pact
95
75
  end
96
76
 
97
77
  def with_matching_rules hash
98
- matching_rules = Pact::MatchingRules.extract hash
99
- example = Pact::Reification.from_term hash
100
- return example if matching_rules.empty?
101
- example.merge(matchingRules: matching_rules)
78
+ matching_rules = Pact::MatchingRules.extract request.to_hash
79
+ return hash if matching_rules.empty?
80
+ hash.merge(matchingRules: matching_rules)
102
81
  end
103
82
 
104
83
  def pact_specification_version
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module MockService
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-mock_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-04-12 00:00:00.000000000 Z
15
+ date: 2017-05-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack