wildcard_matchers 0.1.8 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52e48c6e9eaad4ea695992466a5a726dc7a1e4b1
4
- data.tar.gz: 8f75b0056fba808d7fbe54e72db0b17a3c7056a8
3
+ metadata.gz: 853afdf97de17d19cae1c6f7703e48b314b70ae4
4
+ data.tar.gz: fbc0e3281dc8fbd20219547f33fcc7f6497af99b
5
5
  SHA512:
6
- metadata.gz: 8e31b57f16b51787ab151d90f4a476b7a9923ac279aa7fd0d8101ac3bc548b5914b35e33caa7c5efe53dcebbfc61d7658cbc2797b3190f608b80c681ec6e7867
7
- data.tar.gz: d2d54da9a515823092accf2b0e2c623bf7bfac9dbf2763263087885f19da32c73a7d68991b9940803c4fb242992f977e597b88290763fa5e6a48f7fad0a07c55
6
+ metadata.gz: f21ad64d86ec34f64620abc02e5d511e43b5440a1b7484665f11bb195fd263275f56a6cfed265a7f1ff425fde80706c699b7c7c2aca4aece5e6c7aa72f67fbc3
7
+ data.tar.gz: ff2e4ba038cdd9fd96cd46a34a344b4f2ca37df3c8bc02256fb4d6f567d495b6928aeddad05dab9765cbc51bff9aee9a7e83a161fadf64ef917a6e431269e6e8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.0
2
+ * Update
3
+ * wildcard_matchers now works on rspec3.x (@yuki-hirako)
4
+
1
5
  ## 0.1.8
2
6
  * ENHANCEMENT
3
7
  * wildcard_match have capablity to use block
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require "bundler/gem_tasks"
4
4
  require 'rspec/core'
5
5
  require 'rspec/core/rake_task'
6
6
  RSpec::Core::RakeTask.new(:spec) do |spec|
7
- spec.pattern = FileList['spec/**/*_spec.rb']
7
+ spec.pattern = 'spec/**/*_spec.rb'
8
8
  end
9
9
 
10
10
  task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
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
- failure_message_for_should do |actual|
15
- @matcher.errors.join("\n")
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).should be_true
7
+ expect(wildcard_match?(actual, send(matcher, *args), &debugger)).to be true
8
8
  else
9
- wildcard_match?(actual, matcher, &debugger).should be_true
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).should be_false
20
+ expect(wildcard_match?(actual, send(matcher, *args), &debugger)).to be false
21
21
  else
22
- wildcard_match?(actual, matcher, &debugger).should be_false
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).should be_true
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).should be_true
43
+ expect(wildcard_match?(actual, send(helper, matcher), &debugger)).to be true
44
44
  end
45
45
  end
46
46
  end
@@ -9,6 +9,6 @@ describe WildcardMatchers::Helpers::ForAll do
9
9
  end
10
10
 
11
11
  it "should match using lambda with helper" do
12
- [ 2, 4, 6].should wildcard_match(for_all ->(item) { item % 2 == 0 })
12
+ expect([ 2, 4, 6]).to wildcard_match(for_all ->(item) { item % 2 == 0 })
13
13
  end
14
14
  end
@@ -8,6 +8,6 @@ describe WildcardMatchers::Helpers::ForAny do
8
8
  end
9
9
 
10
10
  it "should match using lambda with helper" do
11
- [ 1, 2, 3 ].should wildcard_match(for_any ->(item) { item % 2 == 0 })
11
+ expect([ 1, 2, 3 ]).to wildcard_match(for_any ->(item) { item % 2 == 0 })
12
12
  end
13
13
  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).should be_false }
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
- ).should be_true
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
- ).should be_true
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.should wildcard_match(expected)
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.should wildcard_match(&expected)
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.should wildcard_match(send(expected))
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.should wildcard_match(expected)
34
+ expect(actual).to wildcard_match(expected)
35
35
  fail # if matched come here and must fail
36
- rescue => e
37
- e.message.should include(failure_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.should wildcard_match([/#{actual.inspect} .+ #{expected.inspect}/])
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.should wildcard_match(expect_failures)
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.1.8
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: 2013-07-26 00:00:00.000000000 Z
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.0.5
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