wildcard_matchers 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/wildcard_matchers/rspec.rb +9 -2
- data/spec/support/shared_examples.rb +6 -6
- data/spec/wildcard_matchers/helpers/for_all_spec.rb +1 -1
- data/spec/wildcard_matchers/helpers/for_any_spec.rb +1 -1
- data/spec/wildcard_matchers/matchers/hash_includes_spec.rb +1 -1
- data/spec/wildcard_matchers/matchers/with_uri_template_spec.rb +4 -4
- data/spec/wildcard_matchers/rspec_spec.rb +6 -6
- data/spec/wildcard_matchers_spec.rb +2 -2
- metadata +27 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 853afdf97de17d19cae1c6f7703e48b314b70ae4
|
4
|
+
data.tar.gz: fbc0e3281dc8fbd20219547f33fcc7f6497af99b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f21ad64d86ec34f64620abc02e5d511e43b5440a1b7484665f11bb195fd263275f56a6cfed265a7f1ff425fde80706c699b7c7c2aca4aece5e6c7aa72f67fbc3
|
7
|
+
data.tar.gz: ff2e4ba038cdd9fd96cd46a34a344b4f2ca37df3c8bc02256fb4d6f567d495b6928aeddad05dab9765cbc51bff9aee9a7e83a161fadf64ef917a6e431269e6e8
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -11,8 +11,15 @@ RSpec::Matchers.define :wildcard_match do |expected|
|
|
11
11
|
@matcher === actual
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
# RSpec now prefers `failure_message` instead of `failure_message_for_should`.
|
15
|
+
if respond_to? :failure_message
|
16
|
+
failure_message do |actual| # RSpec 3.x
|
17
|
+
@matcher.errors.join("\n")
|
18
|
+
end
|
19
|
+
else
|
20
|
+
failure_message_for_should do |actual| # RSpec 1.2, 2.x
|
21
|
+
@matcher.errors.join("\n")
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
|
@@ -4,9 +4,9 @@ shared_examples_for "wildcard match" do |actual, matcher, *args|
|
|
4
4
|
it "#{actual.inspect} with #{expected}" do
|
5
5
|
if matcher.is_a?(Symbol) and WildcardMatchers.respond_to?(matcher)
|
6
6
|
# Note: some symbol comes here and may fail
|
7
|
-
wildcard_match?(actual, send(matcher, *args), &debugger).
|
7
|
+
expect(wildcard_match?(actual, send(matcher, *args), &debugger)).to be true
|
8
8
|
else
|
9
|
-
wildcard_match?(actual, matcher, &debugger).
|
9
|
+
expect(wildcard_match?(actual, matcher, &debugger)).to be true
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -17,9 +17,9 @@ shared_examples_for "not wildcard match" do |actual, matcher, *args|
|
|
17
17
|
it "#{actual.inspect} with #{expected}" do
|
18
18
|
if matcher.is_a?(Symbol) and WildcardMatchers.respond_to?(matcher)
|
19
19
|
# Note: some symbol comes here and may fail
|
20
|
-
wildcard_match?(actual, send(matcher, *args), &debugger).
|
20
|
+
expect(wildcard_match?(actual, send(matcher, *args), &debugger)).to be false
|
21
21
|
else
|
22
|
-
wildcard_match?(actual, matcher, &debugger).
|
22
|
+
expect(wildcard_match?(actual, matcher, &debugger)).to be false
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -38,9 +38,9 @@ shared_examples_for "wildcard match with helper" do |actual, helper, matcher, *a
|
|
38
38
|
it "#{actual.inspect} with #{expected}" do
|
39
39
|
if matcher.is_a?(Symbol) and WildcardMatchers.respond_to?(matcher)
|
40
40
|
# Note: some symbol comes here and may fail
|
41
|
-
wildcard_match?(actual, send(helper, send(matcher, *args)), &debugger).
|
41
|
+
expect(wildcard_match?(actual, send(helper, send(matcher, *args)), &debugger)).to be true
|
42
42
|
else
|
43
|
-
wildcard_match?(actual, send(helper, matcher), &debugger).
|
43
|
+
expect(wildcard_match?(actual, send(helper, matcher), &debugger)).to be true
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -18,6 +18,6 @@ describe WildcardMatchers::Matchers::HashIncludes do
|
|
18
18
|
# bug
|
19
19
|
it "cannot be corrupted" do
|
20
20
|
matcher = hash_includes(a: 1)
|
21
|
-
2.times { wildcard_match?({ a: 2 }, matcher, &debugger).
|
21
|
+
2.times { expect(wildcard_match?({ a: 2 }, matcher, &debugger)).to be false }
|
22
22
|
end
|
23
23
|
end
|
@@ -28,19 +28,19 @@ describe WildcardMatchers::Matchers::WithUriTemplate do
|
|
28
28
|
|
29
29
|
context "with without_query!" do
|
30
30
|
it "works" do
|
31
|
-
wildcard_match?(
|
31
|
+
expect(wildcard_match?(
|
32
32
|
"http://example.com/?hoge=fuga&fuga=ugu",
|
33
33
|
with_uri_template("http://example.com/{?hoge}", hash_includes("hoge" => "fuga")).without_query!,
|
34
34
|
&debugger
|
35
|
-
).
|
35
|
+
)).to be true
|
36
36
|
end
|
37
37
|
|
38
38
|
it "works" do
|
39
|
-
wildcard_match?(
|
39
|
+
expect(wildcard_match?(
|
40
40
|
"http://example.com/ugu?hoge=fuga&fuga=ugu",
|
41
41
|
with_uri_template("http://example.com/{piyo}{?hoge}", hash_includes("hoge" => "fuga", "piyo" => "ugu")).without_query!,
|
42
42
|
&debugger
|
43
|
-
).
|
43
|
+
)).to be true
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -4,21 +4,21 @@ describe "matcher wildcard_match" do
|
|
4
4
|
[ [ 1, Integer ],
|
5
5
|
].each do |actual, expected|
|
6
6
|
it "match #{actual.inspect} with #{expected}" do
|
7
|
-
actual.
|
7
|
+
expect(actual).to wildcard_match(expected)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
[ [ 1, ->(e) { e == 1 } ],
|
12
12
|
].each do |actual, expected|
|
13
13
|
it "match #{actual.inspect} with #{expected} block" do
|
14
|
-
actual.
|
14
|
+
expect(actual).to wildcard_match(&expected)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
[ [ "1", :is_a_string ],
|
19
19
|
].each do |actual, expected|
|
20
20
|
it "match #{actual.inspect} with #{expected}" do
|
21
|
-
actual.
|
21
|
+
expect(actual).to wildcard_match(send(expected))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -31,10 +31,10 @@ describe "matcher wildcard_match" do
|
|
31
31
|
].each do |actual, expected, failure_message|
|
32
32
|
it "not match #{actual.inspect} with #{expected} and return #{failure_message.inspect} as failure_message" do
|
33
33
|
begin
|
34
|
-
actual.
|
34
|
+
expect(actual).to wildcard_match(expected)
|
35
35
|
fail # if matched come here and must fail
|
36
|
-
rescue => e
|
37
|
-
e.message.
|
36
|
+
rescue RSpec::Expectations::ExpectationNotMetError => e
|
37
|
+
expect(e.message).to include(failure_message)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -81,7 +81,7 @@ describe target do
|
|
81
81
|
|
82
82
|
failure = nil
|
83
83
|
wildcard_match?(actual, expected) {|errors| failure = errors }
|
84
|
-
failure.
|
84
|
+
expect(failure).to wildcard_match([/#{actual.inspect} .+ #{expected.inspect}/])
|
85
85
|
end
|
86
86
|
|
87
87
|
it "can get several failure messages" do
|
@@ -93,7 +93,7 @@ describe target do
|
|
93
93
|
|
94
94
|
expect_failures = [ /#{actual.first}.+#{expected.first}/,
|
95
95
|
/#{actual.last}.+#{expected.last}/ ]
|
96
|
-
failure.
|
96
|
+
expect(failure).to wildcard_match(expect_failures)
|
97
97
|
end
|
98
98
|
|
99
99
|
# TODO: more failure message
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wildcard_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- okitan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: addressable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: autowatchr
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: tapp
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: coveralls
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: wildcard matchers
|
@@ -129,12 +129,12 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
- .coveralls.yml
|
133
|
-
- .gitignore
|
134
|
-
- .rspec
|
135
|
-
- .ruby-gemset
|
136
|
-
- .ruby-version
|
137
|
-
- .travis.yml
|
132
|
+
- ".coveralls.yml"
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".ruby-gemset"
|
136
|
+
- ".ruby-version"
|
137
|
+
- ".travis.yml"
|
138
138
|
- CHANGELOG.md
|
139
139
|
- Gemfile
|
140
140
|
- LICENSE
|
@@ -176,17 +176,17 @@ require_paths:
|
|
176
176
|
- lib
|
177
177
|
required_ruby_version: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- -
|
179
|
+
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
|
-
- -
|
184
|
+
- - ">="
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
188
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.2.2
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: wildcard matchers which can use in rspec
|