wildcard_matchers 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/VERSION +1 -1
- data/lib/wildcard_matchers/helpers.rb +2 -2
- data/spec/wildcard_matchers/helpers_spec.rb +4 -4
- metadata +2 -2
data/README.md
CHANGED
@@ -40,8 +40,8 @@ See specs, for more detail.
|
|
40
40
|
* nil_or
|
41
41
|
* nil_or(is_a_string) === nil #=> true
|
42
42
|
* nil_or(is_a_string) === "a" #=> true
|
43
|
-
*
|
44
|
-
*
|
43
|
+
* for_all
|
44
|
+
* for_all(is_a_string) === %w[ a b c ] #=> true
|
45
45
|
|
46
46
|
## How it works
|
47
47
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -6,13 +6,13 @@ module WildcardMatchers
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def for_all(expected = nil, &on_failure)
|
10
10
|
raise "expected or block is mandatory" unless expected or block_given?
|
11
11
|
|
12
12
|
expected ||= block
|
13
13
|
lambda do |actual|
|
14
14
|
actual.all? do |item|
|
15
|
-
wildcard_match(item, expected, &on_failure)
|
15
|
+
wildcard_match?(item, expected, &on_failure)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -5,14 +5,14 @@ describe WildcardMatchers::Helpers do
|
|
5
5
|
[ "aaa", :nil_or, String ],
|
6
6
|
[ nil, :nil_or, :is_a_string ],
|
7
7
|
[ "aaa", :nil_or, :is_a_string ],
|
8
|
-
[ %w[ a b c ], :
|
9
|
-
[ %w[ a b c ], :
|
10
|
-
[ %w[ a b c ], :
|
8
|
+
[ %w[ a b c ], :for_all, String ],
|
9
|
+
[ %w[ a b c ], :for_all, :is_a_string ],
|
10
|
+
[ %w[ a b c ], :for_all, :is_a, String ],
|
11
11
|
].each do |actual, helper, matcher, *args|
|
12
12
|
it_should_behave_like "wildcard match with helper", actual, helper, matcher, *args
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should match using lambda with helper" do
|
16
|
-
[ 2, 4, 6].should wildcard_match(
|
16
|
+
[ 2, 4, 6].should wildcard_match(for_all ->(item) { item % 2 == 0 })
|
17
17
|
end
|
18
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wildcard_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|