rspec-expectations 2.14.4 → 2.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/Changelog.md +7 -0
- data/lib/rspec/expectations/version.rb +1 -1
- data/lib/rspec/matchers/built_in/base_matcher.rb +7 -5
- data/spec/rspec/matchers/base_matcher_spec.rb +21 -0
- data/spec/rspec/matchers/equal_spec.rb +26 -0
- metadata +58 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f05471f3e092a7949e6a65050baebd47319f3244
|
4
|
+
data.tar.gz: d285c05c76c8e3185c735444436bb26f09f76900
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e035793f67b9d902d8afa94ede41915f39aa8bfacddf8cb1a03ed2c89d2e40ee0ecee5dc4bc8557d8ad933d9f33179a971d3cdd1bb2944cfdec12f27b0ddbb90
|
7
|
+
data.tar.gz: f217c62ff802d25bde703e383e7b73deb28b9c895edc14e8576fae14db9ada4264bdd4cc8edd29372e5bb8dd37abf7ca1c21eda446d6bdea9d034b5c1017abd2
|
data/Changelog.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
### 2.14.5 / 2014-02-01
|
2
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.4...v2.14.5)
|
3
|
+
|
4
|
+
Bug fixes
|
5
|
+
|
6
|
+
* Fix wrong matcher descriptions with falsey expected value (yujinakayama)
|
7
|
+
|
1
8
|
### 2.14.4 / 2013-11-06
|
2
9
|
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.3...v2.14.4)
|
3
10
|
|
@@ -14,10 +14,12 @@ module RSpec
|
|
14
14
|
class BaseMatcher
|
15
15
|
include RSpec::Matchers::Pretty
|
16
16
|
|
17
|
+
UNDEFINED = Object.new.freeze
|
18
|
+
|
17
19
|
attr_reader :actual, :expected, :rescued_exception
|
18
20
|
|
19
|
-
def initialize(expected =
|
20
|
-
@expected = expected
|
21
|
+
def initialize(expected = UNDEFINED)
|
22
|
+
@expected = expected unless UNDEFINED.equal?(expected)
|
21
23
|
end
|
22
24
|
|
23
25
|
def matches?(actual)
|
@@ -36,17 +38,17 @@ module RSpec
|
|
36
38
|
end
|
37
39
|
|
38
40
|
def failure_message_for_should
|
39
|
-
assert_ivars :@actual
|
41
|
+
assert_ivars :@actual
|
40
42
|
"expected #{@actual.inspect} to #{name_to_sentence}#{expected_to_sentence}"
|
41
43
|
end
|
42
44
|
|
43
45
|
def failure_message_for_should_not
|
44
|
-
assert_ivars :@actual
|
46
|
+
assert_ivars :@actual
|
45
47
|
"expected #{@actual.inspect} not to #{name_to_sentence}#{expected_to_sentence}"
|
46
48
|
end
|
47
49
|
|
48
50
|
def description
|
49
|
-
expected ? "#{name_to_sentence} #{@expected.inspect}" : name_to_sentence
|
51
|
+
defined?(@expected) ? "#{name_to_sentence} #{@expected.inspect}" : name_to_sentence
|
50
52
|
end
|
51
53
|
|
52
54
|
def diffable?
|
@@ -39,6 +39,27 @@ module RSpec::Matchers::BuiltIn
|
|
39
39
|
|
40
40
|
end
|
41
41
|
|
42
|
+
describe "#failure_message_for_should" do
|
43
|
+
context "when the parameter to .new is omitted" do
|
44
|
+
it "describes what was expected" do
|
45
|
+
matcher_class = Class.new(BaseMatcher) do
|
46
|
+
def name=(name)
|
47
|
+
@name = name
|
48
|
+
end
|
49
|
+
|
50
|
+
def match(expected, actual)
|
51
|
+
false
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
matcher = matcher_class.new
|
56
|
+
matcher.name = "be something"
|
57
|
+
matcher.matches?("foo")
|
58
|
+
expect(matcher.failure_message_for_should).to eq('expected "foo" to be something')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
42
63
|
describe "#==" do
|
43
64
|
it "responds the same way as matches?" do
|
44
65
|
matcher = Class.new(BaseMatcher) do
|
@@ -24,6 +24,32 @@ module RSpec
|
|
24
24
|
expect(matcher.description).to eq "equal 1"
|
25
25
|
end
|
26
26
|
|
27
|
+
context "when the expected object is falsey in conditinal semantics" do
|
28
|
+
it "describes itself with the expected object" do
|
29
|
+
matcher = equal(nil)
|
30
|
+
matcher.matches?(nil)
|
31
|
+
expect(matcher.description).to eq "equal nil"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "when the expected object's #equal? always returns true" do
|
36
|
+
let(:strange_string) do
|
37
|
+
string = "foo"
|
38
|
+
|
39
|
+
def string.equal?(other)
|
40
|
+
true
|
41
|
+
end
|
42
|
+
|
43
|
+
string
|
44
|
+
end
|
45
|
+
|
46
|
+
it "describes itself with the expected object" do
|
47
|
+
matcher = equal(strange_string)
|
48
|
+
matcher.matches?(strange_string)
|
49
|
+
expect(matcher.description).to eq 'equal "foo"'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
27
53
|
it "suggests the `eq` matcher on failure" do
|
28
54
|
expected, actual = "1", "1"
|
29
55
|
expect {
|
metadata
CHANGED
@@ -1,84 +1,69 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-expectations
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.14.5
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Steven Baker
|
8
8
|
- David Chelimsky
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
requirements:
|
18
|
-
- -
|
19
|
-
- !ruby/object:Gem::Version
|
12
|
+
|
13
|
+
date: 2014-02-01 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
20
|
version: 1.1.3
|
21
21
|
- - <
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
type: :runtime
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "2.0"
|
25
24
|
prerelease: false
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.0'
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: rake
|
36
|
-
requirement: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
25
|
+
name: diff-lcs
|
26
|
+
type: :runtime
|
27
|
+
requirement: *id001
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
38
31
|
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
32
|
+
- !ruby/object:Gem::Version
|
40
33
|
version: 10.0.0
|
41
|
-
type: :development
|
42
34
|
prerelease: false
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
name: cucumber
|
50
|
-
requirement: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
35
|
+
name: rake
|
36
|
+
type: :development
|
37
|
+
requirement: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
52
41
|
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
54
43
|
version: 1.1.9
|
55
|
-
type: :development
|
56
44
|
prerelease: false
|
57
|
-
|
58
|
-
|
45
|
+
name: cucumber
|
46
|
+
type: :development
|
47
|
+
requirement: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
59
51
|
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0.5"
|
54
|
+
prerelease: false
|
63
55
|
name: aruba
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.5'
|
69
56
|
type: :development
|
70
|
-
|
71
|
-
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0.5'
|
57
|
+
requirement: *id004
|
76
58
|
description: rspec expectations (should[_not] and matchers)
|
77
59
|
email: rspec-users@rubyforge.org
|
78
60
|
executables: []
|
61
|
+
|
79
62
|
extensions: []
|
63
|
+
|
80
64
|
extra_rdoc_files: []
|
81
|
-
|
65
|
+
|
66
|
+
files:
|
82
67
|
- lib/rspec-expectations.rb
|
83
68
|
- lib/rspec/expectations.rb
|
84
69
|
- lib/rspec/expectations/deprecation.rb
|
@@ -212,31 +197,32 @@ files:
|
|
212
197
|
- spec/support/ruby_version.rb
|
213
198
|
- spec/support/shared_examples.rb
|
214
199
|
homepage: http://github.com/rspec/rspec-expectations
|
215
|
-
licenses:
|
200
|
+
licenses:
|
216
201
|
- MIT
|
217
202
|
metadata: {}
|
203
|
+
|
218
204
|
post_install_message:
|
219
|
-
rdoc_options:
|
205
|
+
rdoc_options:
|
220
206
|
- --charset=UTF-8
|
221
|
-
require_paths:
|
207
|
+
require_paths:
|
222
208
|
- lib
|
223
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
224
|
-
requirements:
|
225
|
-
-
|
226
|
-
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
version: '0'
|
209
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- &id005
|
212
|
+
- ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: "0"
|
215
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
|
+
requirements:
|
217
|
+
- *id005
|
233
218
|
requirements: []
|
219
|
+
|
234
220
|
rubyforge_project: rspec
|
235
221
|
rubygems_version: 2.0.3
|
236
222
|
signing_key:
|
237
223
|
specification_version: 4
|
238
|
-
summary: rspec-expectations-2.14.
|
239
|
-
test_files:
|
224
|
+
summary: rspec-expectations-2.14.5
|
225
|
+
test_files:
|
240
226
|
- features/README.md
|
241
227
|
- features/Upgrade.md
|
242
228
|
- features/built_in_matchers/README.md
|