pact-mock_service 0.12.1 → 1.0.0
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 +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/pact/consumer_contract/request_decorator.rb +50 -11
- data/lib/pact/mock_service/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 502b6bb8fc1c02f95eb7cc9eceda437d070c14fd
|
4
|
+
data.tar.gz: 7899667f864724cf2dd32c35a914b21cb1fa670e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd0da22f52dd902c8663a31e1a806cfc2bd86585b0cd8109b2158ad67732e3da0e5299723fdd358136c48f6ba4aab6c7d890b421f0d4be089a8936adbb9dbac0
|
7
|
+
data.tar.gz: 660b0087a8545dfcf910600649a27aeba7c7cdd991e2402e2455bfb411a8dafc7e3c1947c73085dbb0f8b82c5d77e8225efc693ebc9879f91e0eba34831c68dd
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,8 @@ 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
|
+
* 18b98c0 - Included request matching rules in pact file (Matt Baumgartner, Wed Feb 15 16:20:50 2017 -0500)
|
6
|
+
|
5
7
|
### 0.12.1 (11 Jan 2017)
|
6
8
|
* a0fbb02 - Upgrade Traveling Ruby to work on ruby 2.2.x (Matt Fellows, Tue Jan 10 22:57:32 2017 +1100)
|
7
9
|
|
@@ -20,7 +20,7 @@ module Pact
|
|
20
20
|
hash[:query] = query if request.specified?(:query)
|
21
21
|
hash[:headers] = headers if request.specified?(:headers)
|
22
22
|
hash[:body] = body if request.specified?(:body)
|
23
|
-
hash
|
23
|
+
include_matching_rules? ? with_matching_rules(hash) : hash
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
@@ -28,17 +28,32 @@ module Pact
|
|
28
28
|
attr_reader :request
|
29
29
|
|
30
30
|
def path
|
31
|
-
|
31
|
+
if include_matching_rules?
|
32
|
+
request.path
|
33
|
+
else
|
34
|
+
Pact::Reification.from_term(request.path)
|
35
|
+
end
|
32
36
|
end
|
33
37
|
|
34
|
-
def
|
35
|
-
|
38
|
+
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
|
36
49
|
end
|
37
50
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
51
|
+
def headers
|
52
|
+
if include_matching_rules?
|
53
|
+
request.headers
|
54
|
+
else
|
55
|
+
Pact::Reification.from_term(request.headers)
|
56
|
+
end
|
42
57
|
end
|
43
58
|
|
44
59
|
# This feels wrong to be checking the class type of the body
|
@@ -47,7 +62,11 @@ module Pact
|
|
47
62
|
if content_type_is_form && request.body.is_a?(Hash)
|
48
63
|
URI.encode_www_form convert_hash_body_to_array_of_arrays
|
49
64
|
else
|
50
|
-
|
65
|
+
if include_matching_rules?
|
66
|
+
request.body
|
67
|
+
else
|
68
|
+
Pact::Reification.from_term(request.body)
|
69
|
+
end
|
51
70
|
end
|
52
71
|
end
|
53
72
|
|
@@ -63,8 +82,28 @@ module Pact
|
|
63
82
|
arrays << [key, value]
|
64
83
|
end
|
65
84
|
end
|
66
|
-
|
85
|
+
|
86
|
+
if include_matching_rules?
|
87
|
+
arrays
|
88
|
+
else
|
89
|
+
Pact::Reification.from_term(arrays)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def include_matching_rules?
|
94
|
+
pact_specification_version && !pact_specification_version.start_with?('1')
|
95
|
+
end
|
96
|
+
|
97
|
+
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)
|
102
|
+
end
|
103
|
+
|
104
|
+
def pact_specification_version
|
105
|
+
@decorator_options[:pact_specification_version]
|
67
106
|
end
|
68
107
|
|
69
108
|
end
|
70
|
-
end
|
109
|
+
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: 0.
|
4
|
+
version: 1.0.0
|
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-
|
15
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -331,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
331
|
version: '0'
|
332
332
|
requirements: []
|
333
333
|
rubyforge_project:
|
334
|
-
rubygems_version: 2.5
|
334
|
+
rubygems_version: 2.4.5
|
335
335
|
signing_key:
|
336
336
|
specification_version: 4
|
337
337
|
summary: Provides a mock service for use with Pact
|