pact-support 1.6.3 → 1.6.4
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 +9 -0
- data/lib/pact/reification.rb +3 -3
- data/lib/pact/support/version.rb +1 -1
- data/spec/lib/pact/consumer_contract/query_hash_spec.rb +9 -0
- data/spec/lib/pact/reification_spec.rb +11 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff8ff3846a8b04e97c85f0bc41ec7d0162e58195
|
4
|
+
data.tar.gz: aba56d2bc4538303c403f236897ef29dd769c79c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afc426f3151482889c6aec89940d44db5301f657e690bb34985a37af38c82c00cbbf1bc0ba865876b92688ebaeb10635ef157b9e99e31868619d1cfcbc73035c
|
7
|
+
data.tar.gz: 9cf48a3493ddf6ef465720c79dd9b61e5588c206ddbba3d51b4997b0d13ef4b59162f14867961d6cbbacd6253584053c8c941337480476e5196d61855930b407
|
data/CHANGELOG.md
CHANGED
data/lib/pact/reification.rb
CHANGED
@@ -26,13 +26,13 @@ module Pact
|
|
26
26
|
when Pact::QueryString
|
27
27
|
from_term(term.query)
|
28
28
|
when Pact::QueryHash
|
29
|
-
term.query.map { |k, v|
|
29
|
+
from_term(term.query).map { |k, v|
|
30
30
|
if v.nil?
|
31
31
|
k
|
32
32
|
elsif v.is_a?(Array) #For cases where there are multiple instance of the same parameter
|
33
|
-
v.map { |x| "#{k}=#{escape(
|
33
|
+
v.map { |x| "#{k}=#{escape(x)}"}.join('&')
|
34
34
|
else
|
35
|
-
"#{k}=#{escape(
|
35
|
+
"#{k}=#{escape(v)}"
|
36
36
|
end
|
37
37
|
}.join('&')
|
38
38
|
else
|
data/lib/pact/support/version.rb
CHANGED
@@ -72,6 +72,15 @@ module Pact
|
|
72
72
|
expect(subject.difference(other).keys).to contain_exactly(:"param[a]", :"param[a][aa]", :"param[a][bb]")
|
73
73
|
end
|
74
74
|
end
|
75
|
+
|
76
|
+
context "when there is an ArrayLike" do
|
77
|
+
let(:query) { { param: Pact.each_like("1") } }
|
78
|
+
let(:other) { QueryString.new('param=1¶m=2') }
|
79
|
+
|
80
|
+
it 'returns an empty diff' do
|
81
|
+
expect(subject.difference(other)).to be_empty
|
82
|
+
end
|
83
|
+
end
|
75
84
|
end
|
76
85
|
end
|
77
86
|
|
@@ -122,10 +122,9 @@ module Pact
|
|
122
122
|
end
|
123
123
|
|
124
124
|
context "when Hash Query with UTF-8 string" do
|
125
|
-
|
126
125
|
subject { Reification.from_term(query)}
|
127
126
|
|
128
|
-
let(:query) { QueryHash.new(
|
127
|
+
let(:query) { QueryHash.new(param: 'ILove', extra: '寿司') }
|
129
128
|
|
130
129
|
it "returns the hash with escaping UTF-8 string" do
|
131
130
|
expect(subject).to eq("param=ILove&extra=%E5%AF%BF%E5%8F%B8")
|
@@ -133,7 +132,6 @@ module Pact
|
|
133
132
|
end
|
134
133
|
|
135
134
|
context "when Hash Query with embeded terms" do
|
136
|
-
|
137
135
|
subject { Reification.from_term(query)}
|
138
136
|
|
139
137
|
let(:query) { QueryHash.new( {param: 'hello', extra: Pact::Term.new(generate: "wonderworld", matcher: /\w+world/)})}
|
@@ -141,10 +139,9 @@ module Pact
|
|
141
139
|
it "returns the hash in the natural order, and fills in Terms appropriately" do
|
142
140
|
expect(subject).to eq("param=hello&extra=wonderworld")
|
143
141
|
end
|
144
|
-
|
145
142
|
end
|
146
|
-
context "when Hash Query with Arrays and multiple params with the same name" do
|
147
143
|
|
144
|
+
context "when Hash Query with Arrays and multiple params with the same name" do
|
148
145
|
subject { Reification.from_term(query)}
|
149
146
|
|
150
147
|
let(:query) { QueryHash.new( {param: 'hello', double: [Pact::Term.new(generate: "wonder", matcher: /\w+/), 'world'], simple: 'bye'})}
|
@@ -152,8 +149,16 @@ module Pact
|
|
152
149
|
it "returns the hash in the natural order, and fills in Terms appropriately" do
|
153
150
|
expect(subject).to eq("param=hello&double=wonder&double=world&simple=bye")
|
154
151
|
end
|
155
|
-
|
156
152
|
end
|
157
153
|
|
154
|
+
context "when Hash Query with an ArrayLike" do
|
155
|
+
subject { Reification.from_term(query)}
|
156
|
+
|
157
|
+
let(:query) { QueryHash.new(param: Pact.each_like("1", min: 2)) }
|
158
|
+
|
159
|
+
it "turns the hash into a string with the right number of params" do
|
160
|
+
expect(subject).to eq("param=1¶m=1")
|
161
|
+
end
|
162
|
+
end
|
158
163
|
end
|
159
164
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.4
|
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: 2018-07-
|
15
|
+
date: 2018-07-14 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|