hash_dealer 1.1.3 → 1.2.0
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/matcher.rb +6 -2
- data/spec/lib/matcher_spec.rb +4 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/hash_dealer.gemspec
CHANGED
data/lib/matcher.rb
CHANGED
@@ -18,12 +18,16 @@ RSpec::Matchers.define(:match_response) do |actual|
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# alias as match_json
|
21
|
-
RSpec::Matchers.define(:
|
21
|
+
RSpec::Matchers.define(:match_list) do |actual|
|
22
22
|
|
23
23
|
match do |expected|
|
24
|
+
actual = JSON.parse(actual) if actual.is_a?(String)
|
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)
|
24
28
|
PathString.as_sorted_json(actual) == PathString.as_sorted_json(expected)
|
25
29
|
end
|
26
|
-
|
30
|
+
|
27
31
|
failure_message_for_should do |container|
|
28
32
|
"expected #{PathString.as_sorted_json(actual)}\n to equal\n #{PathString.as_sorted_json(container)}"
|
29
33
|
end
|
data/spec/lib/matcher_spec.rb
CHANGED
@@ -10,4 +10,8 @@ describe "match_resonse Matcher" do
|
|
10
10
|
{:a => {:b => "/test/test"}}.should match_response({"a" =>{"b" => "/:a/:b"}})
|
11
11
|
end
|
12
12
|
|
13
|
+
it "should match the first element in a list" do
|
14
|
+
{"a" => ":b"}.should match_list([{"a" => "test"}, {"a" => "test2"}])
|
15
|
+
end
|
16
|
+
|
13
17
|
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.
|
5
|
+
version: 1.2.0
|
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: 4171646845594495161
|
133
133
|
segments:
|
134
134
|
- 0
|
135
135
|
version: "0"
|