rspec-expectations 2.11.0 → 2.11.1
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.
data/Changelog.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
### 2.11.1 / 2012-07-08
|
2
|
+
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.0...v2.11.1)
|
3
|
+
|
4
|
+
Bug fix
|
5
|
+
|
6
|
+
* Constrain `actual` in `be_within` matcher to values that respond to `-` instead
|
7
|
+
of requiring a specific type.
|
8
|
+
* `Time`, for example, is a legit alternative.
|
9
|
+
|
1
10
|
### 2.11.0 / 2012-07-07
|
2
11
|
[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.10.0...v2.11.0)
|
3
12
|
|
@@ -8,8 +8,8 @@ module RSpec
|
|
8
8
|
|
9
9
|
def matches?(actual)
|
10
10
|
@actual = actual
|
11
|
-
raise needs_expected
|
12
|
-
raise
|
11
|
+
raise needs_expected unless defined? @expected
|
12
|
+
raise needs_subtractable unless @actual.respond_to? :-
|
13
13
|
(@actual - @expected).abs <= @delta
|
14
14
|
end
|
15
15
|
|
@@ -32,8 +32,8 @@ module RSpec
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
-
def
|
36
|
-
ArgumentError.new "The actual value (#{@actual.inspect}) must
|
35
|
+
def needs_subtractable
|
36
|
+
ArgumentError.new "The actual value (#{@actual.inspect}) must respond to `-`"
|
37
37
|
end
|
38
38
|
|
39
39
|
def needs_expected
|
@@ -49,6 +49,10 @@ module RSpec
|
|
49
49
|
matcher.failure_message_for_should_not.should == "expected 5.49 not to be within 0.5 of 5.0"
|
50
50
|
end
|
51
51
|
|
52
|
+
it "works with Time" do
|
53
|
+
Time.now.should be_within(0.001).of(Time.now)
|
54
|
+
end
|
55
|
+
|
52
56
|
it "provides a description" do
|
53
57
|
matcher = be_within(0.5).of(5.0)
|
54
58
|
matcher.matches?(5.1)
|
@@ -62,9 +66,9 @@ module RSpec
|
|
62
66
|
)
|
63
67
|
end
|
64
68
|
|
65
|
-
it "raises an error if the actual
|
69
|
+
it "raises an error if the actual does not respond to :-" do
|
66
70
|
expect { be_within(0.1).of(0).matches?(nil) }.to raise_error(
|
67
|
-
ArgumentError, /The actual value \(nil\) must
|
71
|
+
ArgumentError, /The actual value \(nil\) must respond to `-`/
|
68
72
|
)
|
69
73
|
end
|
70
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-expectations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-07-
|
13
|
+
date: 2012-07-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: diff-lcs
|
@@ -224,7 +224,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
224
224
|
version: '0'
|
225
225
|
segments:
|
226
226
|
- 0
|
227
|
-
hash:
|
227
|
+
hash: 4256634287402574449
|
228
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
229
229
|
none: false
|
230
230
|
requirements:
|
@@ -233,13 +233,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
233
|
version: '0'
|
234
234
|
segments:
|
235
235
|
- 0
|
236
|
-
hash:
|
236
|
+
hash: 4256634287402574449
|
237
237
|
requirements: []
|
238
238
|
rubyforge_project: rspec
|
239
239
|
rubygems_version: 1.8.24
|
240
240
|
signing_key:
|
241
241
|
specification_version: 3
|
242
|
-
summary: rspec-expectations-2.11.
|
242
|
+
summary: rspec-expectations-2.11.1
|
243
243
|
test_files:
|
244
244
|
- features/README.md
|
245
245
|
- features/Upgrade.md
|