wildcard_matchers 0.1.6 → 0.1.7
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 +5 -0
- data/README.md +2 -2
- data/VERSION +1 -1
- data/lib/wildcard_matchers/matchers/hash_includes.rb +7 -8
- data/lib/wildcard_matchers/wildcard_matcher.rb +1 -1
- data/spec/wildcard_matchers/matchers/hash_includes_spec.rb +6 -0
- data/spec/wildcard_matchers/matchers/with_uri_template_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16a8d8b0edac8954945e5018a609e69ffd257831
|
4
|
+
data.tar.gz: 1dba61fbe05640ade3e9bb51cdbd44d403183433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b65c2dffab4acc2aca7f8de06a4fd664a69d4ce824d74137808c6d7e3081d86a38797b737bfaad5666bd5b55498a54ff69cde6c8bf770b549b3f74a763ef97ba
|
7
|
+
data.tar.gz: f0862de1b4bc36cb6de370e41e5583a5e56ab309eae25b0c246c8b6a65f5e51d8cb1596deee14363973b2030276897ff1e1d250f004e9f5f8df2ef50982335dd
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -28,8 +28,8 @@ See specs, for more detail.
|
|
28
28
|
* is_bool === object #=> false
|
29
29
|
* is_time
|
30
30
|
* is_time === "2012-05-13" #=> true
|
31
|
-
*
|
32
|
-
*
|
31
|
+
* is_uri
|
32
|
+
* is_uri(:host => "example.com") === "http://example.com" #=> true
|
33
33
|
* with_uri_template
|
34
34
|
* with_uri_template("http://example.com/users/{id}", "id" => "1") === "http://example.com/users/1" #=> true
|
35
35
|
* with_uri_template("http://example.com/users{?id}", "id" => "1") === "http://example.com/users?id=1" #=> true
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
@@ -11,15 +11,14 @@ module WildcardMatchers
|
|
11
11
|
return
|
12
12
|
end
|
13
13
|
|
14
|
-
hash_to_match = {}
|
15
|
-
hash_to_match = expectation.pop if expectation.last.is_a?(Hash)
|
16
|
-
|
17
14
|
expectation.each do |key|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
unless key.is_a?(Hash)
|
16
|
+
errors << "#{position}: expect #{actual} to have key #{key}" unless actual.has_key?(key)
|
17
|
+
else
|
18
|
+
key.each do |key, value|
|
19
|
+
errors.push(*self.class.superclass.check_errors(actual[key], value, position + "[#{key.inspect}]"))
|
20
|
+
end
|
21
|
+
end
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|
@@ -46,7 +46,7 @@ module WildcardMatchers
|
|
46
46
|
when Hash
|
47
47
|
errors.push(*HashMatcher.check_errors(actual, expectation, position))
|
48
48
|
else
|
49
|
-
if defined?(
|
49
|
+
if defined?(::RSpec::Matchers::DSL::Matcher) \
|
50
50
|
&& ::RSpec::Matchers::DSL::Matcher === expectation \
|
51
51
|
&& (expected = expectation.expected.first).is_a?(self.class)
|
52
52
|
# if duplicated wildcard_match extract it
|
@@ -14,4 +14,10 @@ describe WildcardMatchers::Matchers::HashIncludes do
|
|
14
14
|
].each do |actual, matcher, *args|
|
15
15
|
it_behaves_like "not wildcard match", actual, matcher, *args
|
16
16
|
end
|
17
|
+
|
18
|
+
# bug
|
19
|
+
it "cannot be corrupted" do
|
20
|
+
matcher = hash_includes(a: 1)
|
21
|
+
2.times { wildcard_match?({ a: 2 }, matcher, &debugger).should be_false }
|
22
|
+
end
|
17
23
|
end
|
@@ -26,7 +26,7 @@ describe WildcardMatchers::Matchers::WithUriTemplate do
|
|
26
26
|
it_behaves_like "not wildcard match", actual, matcher, *args
|
27
27
|
end
|
28
28
|
|
29
|
-
context "with without_query!"
|
29
|
+
context "with without_query!" do
|
30
30
|
it "works" do
|
31
31
|
wildcard_match?(
|
32
32
|
"http://example.com/?hoge=fuga&fuga=ugu",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wildcard_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- okitan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
188
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.0.
|
189
|
+
rubygems_version: 2.0.5
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: wildcard matchers which can use in rspec
|