pact-support 1.15.5 → 1.16.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
  SHA256:
3
- metadata.gz: eced331decdf4981868c618a63d43239d7a2bb819272d7b64079fc1eb56b952b
4
- data.tar.gz: c09a587cba454b5b2a10f836d405e3c395a008e213fbef930ae4f7898d38fcb1
3
+ metadata.gz: c13a4b7ad88f078970d7e0991fc8e7406a20267b038d67b3c583003b3b18814e
4
+ data.tar.gz: f72c487f5e7f11a5d6db48812028130487d0a0d4a9ac1f8c2726bf5d8d487d4c
5
5
  SHA512:
6
- metadata.gz: f26c19bd7e36e3d9a037e2951711ea4d895bf578cb2156418457bdf36ac95a19a5a9e7dcc78c29a73dd32ad5f733167368e9d0e095b97266c97018d117b91474
7
- data.tar.gz: 8dd47965327e6475cb54aebae53b3e2f0286c7338ffd3fdbd26cb8bb9dced3e5fac034dd2ad3e6e83f8a8cebc63a374affb8b87ccbae505d664e909909c8f23b
6
+ metadata.gz: 985481757b4ec8880946efceb5929aceb818defcd80233ef908ed0cb8f55ed4e8ceb6c9f6e89cee4856dd581fd42dca4b6dc1d244dc9dece6a51fffe456c6915
7
+ data.tar.gz: 8c5bfdc029b6461fb80a64089ef1d003f3dc0f93d2677020c37f9bd733423e1e976058f14199b2d8dcc36e5a648450d786d91a6fb215dbef0aab1e453c56d52a
@@ -1,3 +1,38 @@
1
+ <a name="v1.16.4"></a>
2
+ ### v1.16.4 (2020-11-13)
3
+
4
+ #### Bug Fixes
5
+
6
+ * ensure expected and actual query strings are parsed consistently ([4e9ca9c](/../../commit/4e9ca9c))
7
+
8
+ <a name="v1.16.3"></a>
9
+ ### v1.16.3 (2020-11-10)
10
+
11
+ #### Bug Fixes
12
+
13
+ * add missing params_hash_has_key ([700efa7](/../../commit/700efa7))
14
+
15
+ <a name="v1.16.2"></a>
16
+ ### v1.16.2 (2020-11-07)
17
+
18
+ #### Bug Fixes
19
+
20
+ * removed undefined depth from query ([53a373d](/../../commit/53a373d))
21
+
22
+ <a name="v1.16.1"></a>
23
+ ### v1.16.1 (2020-11-06)
24
+
25
+ #### Bug Fixes
26
+
27
+ * add missing params_hash_type? from Rack ([3195b0a](/../../commit/3195b0a))
28
+
29
+ <a name="v1.16.0"></a>
30
+ ### v1.16.0 (2020-11-04)
31
+
32
+ #### Features
33
+
34
+ * remove runtime dependency on rspec ([aca30e2](/../../commit/aca30e2))
35
+
1
36
  <a name="v1.15.5"></a>
2
37
  ### v1.15.5 (2020-11-04)
3
38
 
@@ -18,7 +18,7 @@ module Pact
18
18
  parsed_query = parse_query(query_string)
19
19
 
20
20
  # If Rails nested params...
21
- if parsed_query.keys.any?{ | key| key.include?("[") }
21
+ if parsed_query.keys.any?{ | key| key =~ /\[.*\]/ }
22
22
  parse_nested_query(query_string)
23
23
  else
24
24
  parsed_query.each_with_object({}) do | (key, value), new_hash |
@@ -99,12 +99,28 @@ module Pact
99
99
  else
100
100
  params[k] ||= {}
101
101
  raise ParameterTypeError, "expected Hash (got #{params[k].class.name}) for param `#{k}'" unless params_hash_type?(params[k])
102
- params[k] = normalize_params(params[k], after, v, depth - 1)
102
+ params[k] = normalize_params(params[k], after, v)
103
103
  end
104
104
 
105
105
  params
106
106
  end
107
107
 
108
+ def self.params_hash_type?(obj)
109
+ obj.is_a?(Hash)
110
+ end
111
+
112
+ def self.params_hash_has_key?(hash, key)
113
+ return false if key =~ /\[\]/
114
+
115
+ key.split(/[\[\]]+/).inject(hash) do |h, part|
116
+ next h if part == ''
117
+ return false unless params_hash_type?(h) && h.key?(part)
118
+ h[part]
119
+ end
120
+
121
+ true
122
+ end
123
+
108
124
  def self.unescape(s, encoding = Encoding::UTF_8)
109
125
  URI.decode_www_form_component(s, encoding)
110
126
  end
@@ -32,7 +32,7 @@ module Pact
32
32
  # from the actual query string.
33
33
  def difference(other)
34
34
  require 'pact/matchers' # avoid recursive loop between this file, pact/reification and pact/matchers
35
- Pact::Matchers.diff(query, symbolize_keys(CGI::parse(other.query)), allow_unexpected_keys: false)
35
+ Pact::Matchers.diff(query, symbolize_keys(convert_to_hash_of_arrays(Query.parse_string(other.query))), allow_unexpected_keys: false)
36
36
  end
37
37
 
38
38
  def query
@@ -1,4 +1,3 @@
1
- require 'rspec'
2
1
  # This is horrible, must work out a better way of doing this
3
2
  module Pact
4
3
  module RSpec
@@ -19,7 +18,6 @@ module Pact
19
18
  require 'pact/provider/rspec/formatter_rspec_2'
20
19
  Pact::Provider::RSpec::Formatter2
21
20
  end
22
-
23
21
  end
24
22
 
25
23
  def self.full_description example
@@ -31,11 +29,11 @@ module Pact
31
29
  end
32
30
 
33
31
  def self.is_rspec_3
34
- ::RSpec::Core::Formatters.respond_to?(:register)
32
+ defined?(::RSpec) && ::RSpec::Core::Formatters.respond_to?(:register)
35
33
  end
36
34
 
37
35
  def self.is_rspec_2
38
- !is_rspec_3
36
+ defined?(::RSpec) && !is_rspec_3
39
37
  end
40
38
 
41
39
  def self.with_rspec_3
@@ -3,9 +3,7 @@ require 'pact/consumer_contract/headers'
3
3
  require 'pact/consumer_contract/query'
4
4
 
5
5
  module Pact
6
-
7
6
  module Request
8
-
9
7
  class Base
10
8
  include Pact::SymbolizeKeys
11
9
 
@@ -91,7 +89,6 @@ module Pact
91
89
  def display_query
92
90
  (query.nil? || query.empty?) ? '' : "?#{Pact::Reification.from_term(query)}"
93
91
  end
94
-
95
92
  end
96
93
  end
97
- end
94
+ end
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Support
3
- VERSION = "1.15.5"
3
+ VERSION = "1.16.4"
4
4
  end
5
5
  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.15.5
4
+ version: 1.16.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: 2020-11-04 00:00:00.000000000 Z
15
+ date: 2020-11-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp
@@ -28,20 +28,6 @@ dependencies:
28
28
  - - "~>"
29
29
  - !ruby/object:Gem::Version
30
30
  version: 0.1.7
31
- - !ruby/object:Gem::Dependency
32
- name: rspec
33
- requirement: !ruby/object:Gem::Requirement
34
- requirements:
35
- - - ">="
36
- - !ruby/object:Gem::Version
37
- version: '2.14'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: '2.14'
45
31
  - !ruby/object:Gem::Dependency
46
32
  name: term-ansicolor
47
33
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +70,26 @@ dependencies:
84
70
  - - "~>"
85
71
  - !ruby/object:Gem::Version
86
72
  version: '1.4'
73
+ - !ruby/object:Gem::Dependency
74
+ name: rspec
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '2.14'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '4.0'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '2.14'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '4.0'
87
93
  - !ruby/object:Gem::Dependency
88
94
  name: rake
89
95
  requirement: !ruby/object:Gem::Requirement