hash_dealer 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/hash_dealer.gemspec +1 -1
- data/lib/core_extensions.rb +2 -1
- data/lib/matcher.rb +9 -7
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.1
|
data/hash_dealer.gemspec
CHANGED
data/lib/core_extensions.rb
CHANGED
data/lib/matcher.rb
CHANGED
@@ -20,20 +20,22 @@ end
|
|
20
20
|
# alias as match_json
|
21
21
|
RSpec::Matchers.define(:match_list) do |actual|
|
22
22
|
|
23
|
+
def normalize(val)
|
24
|
+
val = JSON.parse(val) if val.is_a?(String)
|
25
|
+
val = val.first if val.is_a?(Array)
|
26
|
+
val
|
27
|
+
end
|
28
|
+
|
23
29
|
match do |expected|
|
24
|
-
|
25
|
-
expected = JSON.parse(expected) if expected.is_a?(String)
|
26
|
-
actual = actual.first if actual.is_a?(Array)
|
27
|
-
expected = expected.first if expected.is_a?(Array)
|
28
|
-
PathString.as_sorted_json(actual) == PathString.as_sorted_json(expected)
|
30
|
+
PathString.as_sorted_json(normalize(actual)) == PathString.as_sorted_json(normalize(expected))
|
29
31
|
end
|
30
32
|
|
31
33
|
failure_message_for_should do |container|
|
32
|
-
"expected #{PathString.as_sorted_json(actual)}\n to equal\n #{PathString.as_sorted_json(container)}"
|
34
|
+
"expected #{PathString.as_sorted_json(normalize(actual))}\n to equal\n #{PathString.as_sorted_json(normalize(container))}"
|
33
35
|
end
|
34
36
|
|
35
37
|
failure_message_for_should_not do |container|
|
36
|
-
"expected #{PathString.as_sorted_json(actual)}\n not to equal\n #{PathString.as_sorted_json(container)}"
|
38
|
+
"expected #{PathString.as_sorted_json(normalize(actual))}\n not to equal\n #{PathString.as_sorted_json(normalize(container))}"
|
37
39
|
end
|
38
40
|
|
39
41
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: hash_dealer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Dan Langevin
|
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
129
|
requirements:
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
hash:
|
132
|
+
hash: 3813093345563584248
|
133
133
|
segments:
|
134
134
|
- 0
|
135
135
|
version: "0"
|