pact-support 1.6.3 → 1.6.4

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: add17cb769a9dad8275e79e1320049e8134bfc0a
4
- data.tar.gz: 92d453de103d3ee753736b80c0de57f4323b0725
3
+ metadata.gz: ff8ff3846a8b04e97c85f0bc41ec7d0162e58195
4
+ data.tar.gz: aba56d2bc4538303c403f236897ef29dd769c79c
5
5
  SHA512:
6
- metadata.gz: 4c8c8ccfc4a3a9884b600ac349ffbdb5eee0934867cedf32ae5f6a62919d573d6a383dae9ee675d471b425d6591bc1a0a07b2b1bee1729027ff5a8100963c14f
7
- data.tar.gz: c81c6c65b68b03cb5867e0fc94bf6df9fd849a881fc9936b14c13ec73fea4d1d967e7fdb73b2b5e77208dbe04d0e1a9cfdfffe17f08d80a04b1706e67ba74fd4
6
+ metadata.gz: afc426f3151482889c6aec89940d44db5301f657e690bb34985a37af38c82c00cbbf1bc0ba865876b92688ebaeb10635ef157b9e99e31868619d1cfcbc73035c
7
+ data.tar.gz: 9cf48a3493ddf6ef465720c79dd9b61e5588c206ddbba3d51b4997b0d13ef4b59162f14867961d6cbbacd6253584053c8c941337480476e5196d61855930b407
@@ -1,3 +1,12 @@
1
+ <a name="v1.6.4"></a>
2
+ ### v1.6.4 (2018-07-14)
3
+
4
+
5
+ #### Bug Fixes
6
+
7
+ * correctly serialize query params that use a Pact.each_like in pact file ([b3414dd](/../../commit/b3414dd))
8
+
9
+
1
10
  <a name="v1.6.3"></a>
2
11
  ### v1.6.3 (2018-07-12)
3
12
 
@@ -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(from_term(x))}"}.join('&')
33
+ v.map { |x| "#{k}=#{escape(x)}"}.join('&')
34
34
  else
35
- "#{k}=#{escape(from_term(v))}"
35
+ "#{k}=#{escape(v)}"
36
36
  end
37
37
  }.join('&')
38
38
  else
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Support
3
- VERSION = "1.6.3"
3
+ VERSION = "1.6.4"
4
4
  end
5
5
  end
@@ -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&param=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( {param: 'ILove', extra: '寿司'})}
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&param=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.3
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-12 00:00:00.000000000 Z
15
+ date: 2018-07-14 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp