wildcard_matchers 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +6 -0
- data/README.md +3 -1
- data/VERSION +1 -1
- data/lib/wildcard_matchers/helpers.rb +2 -1
- data/lib/wildcard_matchers/helpers/responding.rb +14 -0
- data/lib/wildcard_matchers/wildcard_matcher.rb +9 -1
- data/spec/spec_helper.rb +3 -0
- data/spec/wildcard_matchers/helpers/responding_spec.rb +8 -0
- data/wildcard_matchers.gemspec +3 -0
- metadata +39 -37
- data/.rvmrc +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e3d9d80d3859e5ea8f844eb3c15967d102d755a6
|
4
|
+
data.tar.gz: 9f1322c48ee56fe565277ab5333340ad770f47c4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c70ea80a0a931e7cab5e4940aa2993f67b86c0e6cc00b50cd91d188eef3b2b67a89398f03014e036ba2ccdb4ac0ac7cf6fcdf590095b46b6ca2b38de0cd427c1
|
7
|
+
data.tar.gz: e799e0cb2eeb1829740e6651d550969bec2c0896a5403199949c7ce2fd7ed347d80289551a040aaaf8051b93c06d34c1523b4202387da041c7fd92ef51dcb690
|
data/.coveralls.yml
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
wildcard_matchers
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# wildcard_matchers [![Build Status](https://secure.travis-ci.org/okitan/wildcard_matchers.png?branch=master)](http://travis-ci.org/okitan/wildcard_matchers) [![Dependency Status](https://gemnasium.com/okitan/wildcard_matchers.png)](https://gemnasium.com/okitan/wildcard_matchers)
|
1
|
+
# wildcard_matchers [![Build Status](https://secure.travis-ci.org/okitan/wildcard_matchers.png?branch=master)](http://travis-ci.org/okitan/wildcard_matchers) [![Dependency Status](https://gemnasium.com/okitan/wildcard_matchers.png)](https://gemnasium.com/okitan/wildcard_matchers) [![Coverage Status](https://coveralls.io/repos/okitan/wildcard_matchers/badge.png?branch=master)](https://coveralls.io/r/okitan/wildcard_matchers)
|
2
2
|
|
3
3
|
## General Usage
|
4
4
|
|
@@ -51,6 +51,8 @@ See specs, for more detail.
|
|
51
51
|
* for_all(is_a_string) === %w[ a b c ] #=> true
|
52
52
|
* for_any
|
53
53
|
* for_any(is_a_string) === [ 1, "1" ] #=> true
|
54
|
+
* responding
|
55
|
+
* responding(next: 2) === 1 #=> true (because 1.next #=> 2)
|
54
56
|
|
55
57
|
## How it works
|
56
58
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
@@ -12,6 +12,7 @@ module WildcardMatchers
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
require "wildcard_matchers/helpers/for_any"
|
15
16
|
require "wildcard_matchers/helpers/for_all"
|
16
17
|
require "wildcard_matchers/helpers/nil_or"
|
17
|
-
require "wildcard_matchers/helpers/
|
18
|
+
require "wildcard_matchers/helpers/responding"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module WildcardMatchers
|
2
|
+
module Helpers
|
3
|
+
define_wildcard_helper(:responding)
|
4
|
+
|
5
|
+
class Responding < ::WildcardMatchers::WildcardMatcher
|
6
|
+
protected
|
7
|
+
def wildcard_match(actual)
|
8
|
+
expectation.each do |key, value|
|
9
|
+
errors.push(*self.class.superclass.check_errors(actual.__send__(key), value, position + ".#{key}"))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -46,7 +46,15 @@ module WildcardMatchers
|
|
46
46
|
when Hash
|
47
47
|
errors.push(*HashMatcher.check_errors(actual, expectation, position))
|
48
48
|
else
|
49
|
-
|
49
|
+
if defined?(:"::RSpec::Matchers::DSL::Matcher") \
|
50
|
+
&& ::RSpec::Matchers::DSL::Matcher === expectation \
|
51
|
+
&& (expected = expectation.expected.first).is_a?(self.class)
|
52
|
+
# if duplicated wildcard_match extract it
|
53
|
+
expected === actual
|
54
|
+
errors.push(*expected.errors)
|
55
|
+
else
|
56
|
+
single_match(actual)
|
57
|
+
end
|
50
58
|
end
|
51
59
|
end
|
52
60
|
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,9 @@ Dir[File.expand_path("support/**/*.rb", File.dirname(__FILE__))].each {|f| requi
|
|
7
7
|
require "pry"
|
8
8
|
require "tapp"
|
9
9
|
|
10
|
+
require 'coveralls'
|
11
|
+
Coveralls.wear!
|
12
|
+
|
10
13
|
RSpec.configure do |config|
|
11
14
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
15
|
config.run_all_when_everything_filtered = true
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe WildcardMatchers::Helpers::Responding do
|
4
|
+
[ [ Struct.new(:hoge).new("fuga"), :responding, { hoge: "fuga" } ],
|
5
|
+
].each do |actual, helper, matcher, *args|
|
6
|
+
it_behaves_like "wildcard match with helper", actual, helper, matcher, *args
|
7
|
+
end
|
8
|
+
end
|
data/wildcard_matchers.gemspec
CHANGED
metadata
CHANGED
@@ -1,36 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wildcard_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- okitan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: facets
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: addressable
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,81 +41,85 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: autowatchr
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: pry
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: tapp
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: coveralls
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
124
123
|
- !ruby/object:Gem::Version
|
125
124
|
version: '0'
|
126
125
|
description: wildcard matchers
|
@@ -130,9 +129,11 @@ executables: []
|
|
130
129
|
extensions: []
|
131
130
|
extra_rdoc_files: []
|
132
131
|
files:
|
132
|
+
- .coveralls.yml
|
133
133
|
- .gitignore
|
134
134
|
- .rspec
|
135
|
-
- .
|
135
|
+
- .ruby-gemset
|
136
|
+
- .ruby-version
|
136
137
|
- .travis.yml
|
137
138
|
- CHANGELOG.md
|
138
139
|
- Gemfile
|
@@ -145,6 +146,7 @@ files:
|
|
145
146
|
- lib/wildcard_matchers/helpers/for_all.rb
|
146
147
|
- lib/wildcard_matchers/helpers/for_any.rb
|
147
148
|
- lib/wildcard_matchers/helpers/nil_or.rb
|
149
|
+
- lib/wildcard_matchers/helpers/responding.rb
|
148
150
|
- lib/wildcard_matchers/matchers.rb
|
149
151
|
- lib/wildcard_matchers/matchers/hash_includes.rb
|
150
152
|
- lib/wildcard_matchers/matchers/is_uri.rb
|
@@ -157,6 +159,7 @@ files:
|
|
157
159
|
- spec/wildcard_matchers/helpers/for_all_spec.rb
|
158
160
|
- spec/wildcard_matchers/helpers/for_any_spec.rb
|
159
161
|
- spec/wildcard_matchers/helpers/nil_or_spec.rb
|
162
|
+
- spec/wildcard_matchers/helpers/responding_spec.rb
|
160
163
|
- spec/wildcard_matchers/matchers/hash_includes_spec.rb
|
161
164
|
- spec/wildcard_matchers/matchers/is_uri_spec.rb
|
162
165
|
- spec/wildcard_matchers/matchers/with_uri_template_spec.rb
|
@@ -166,27 +169,26 @@ files:
|
|
166
169
|
- wildcard_matchers.gemspec
|
167
170
|
homepage: https://github.com/okitan/wildcard_matchers
|
168
171
|
licenses: []
|
172
|
+
metadata: {}
|
169
173
|
post_install_message:
|
170
174
|
rdoc_options: []
|
171
175
|
require_paths:
|
172
176
|
- lib
|
173
177
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
-
none: false
|
175
178
|
requirements:
|
176
|
-
- -
|
179
|
+
- - '>='
|
177
180
|
- !ruby/object:Gem::Version
|
178
181
|
version: '0'
|
179
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
-
none: false
|
181
183
|
requirements:
|
182
|
-
- -
|
184
|
+
- - '>='
|
183
185
|
- !ruby/object:Gem::Version
|
184
186
|
version: '0'
|
185
187
|
requirements: []
|
186
188
|
rubyforge_project:
|
187
|
-
rubygems_version:
|
189
|
+
rubygems_version: 2.0.3
|
188
190
|
signing_key:
|
189
|
-
specification_version:
|
191
|
+
specification_version: 4
|
190
192
|
summary: wildcard matchers which can use in rspec
|
191
193
|
test_files:
|
192
194
|
- spec/spec.watchr
|
@@ -195,10 +197,10 @@ test_files:
|
|
195
197
|
- spec/wildcard_matchers/helpers/for_all_spec.rb
|
196
198
|
- spec/wildcard_matchers/helpers/for_any_spec.rb
|
197
199
|
- spec/wildcard_matchers/helpers/nil_or_spec.rb
|
200
|
+
- spec/wildcard_matchers/helpers/responding_spec.rb
|
198
201
|
- spec/wildcard_matchers/matchers/hash_includes_spec.rb
|
199
202
|
- spec/wildcard_matchers/matchers/is_uri_spec.rb
|
200
203
|
- spec/wildcard_matchers/matchers/with_uri_template_spec.rb
|
201
204
|
- spec/wildcard_matchers/matchers_spec.rb
|
202
205
|
- spec/wildcard_matchers/rspec_spec.rb
|
203
206
|
- spec/wildcard_matchers_spec.rb
|
204
|
-
has_rdoc:
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm gemset use wildcard_matchers --create
|