wrong 0.7.0-java → 0.7.1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +11 -1
- data/lib/wrong.rb +1 -1
- data/lib/wrong/version.rb +1 -1
- metadata +6 -6
data/README.markdown
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
![Someone is Wrong on the Internet](http://imgs.xkcd.com/comics/duty_calls.png)
|
4
4
|
|
5
|
+
Maintained by: Alex Chaffee <http://alexchaffee.com>
|
6
|
+
|
5
7
|
## Abstract ##
|
6
8
|
|
7
9
|
Wrong provides a simple, general assert method that takes a block, and understands the code inside it, providing verbose failure messages for free.
|
@@ -100,7 +102,13 @@ If you want to compare floats, try this:
|
|
100
102
|
|
101
103
|
If you don't want `close_to?` cluttering up `Float` in your test runs then use `include Wrong::Assert` instead of `include Wrong`.
|
102
104
|
|
103
|
-
`close_to?` also works on `Time`s, `Date`s, and `DateTime`s.
|
105
|
+
`close_to?` also works on `Time`s, `Date`s, and `DateTime`s. The default tolerance of 1 msec may be too small for you, so you might want to do something like:
|
106
|
+
|
107
|
+
assert { user.created_at.close_to?(Time.now, 2) } # or 2.seconds
|
108
|
+
|
109
|
+
`close_to?` also works inside RSpec should statements with the magic `be` matcher, e.g.
|
110
|
+
|
111
|
+
5.should be_close_to(6)
|
104
112
|
|
105
113
|
### d
|
106
114
|
|
@@ -295,6 +303,8 @@ Before you get your knickers in a twist about how this is totally unacceptable b
|
|
295
303
|
* Beware of Side Effects! (See discussion elsewhere in this document.)
|
296
304
|
* "Doesn't all this parsing slow down my test run"? No - this applies to failure cases only. If the assert block returns true then Wrong simply moves on.
|
297
305
|
|
306
|
+
FYI, the [method_source gem](https://github.com/banister/method_source) uses a similar algorithm (keep grabbing lines of source code and [try to parse them](https://github.com/banister/method_source/blob/master/lib/method_source/code_helpers.rb#L66) until you stop getting parse errors).
|
307
|
+
|
298
308
|
## Explanations ##
|
299
309
|
|
300
310
|
`assert` and `deny` can take an optional explanation, e.g.
|
data/lib/wrong.rb
CHANGED
@@ -33,7 +33,7 @@ module Wrong
|
|
33
33
|
extend Wrong::Helpers
|
34
34
|
end
|
35
35
|
|
36
|
-
# This `require "wrong/close_to"` adds close_to? to Numeric.
|
36
|
+
# This `require "wrong/close_to"` adds close_to? to Numeric, Date, Time, and DateTime.
|
37
37
|
# If you don't like that, then
|
38
38
|
# `require 'wrong/assert'` et al. individually and don't `require 'wrong/close_to'` or `require 'wrong'`
|
39
39
|
require "wrong/close_to"
|
data/lib/wrong/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wrong
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
prerelease:
|
6
6
|
platform: java
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: predicated
|
@@ -83,7 +83,7 @@ dependencies:
|
|
83
83
|
requirements:
|
84
84
|
- - ~>
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 1.
|
86
|
+
version: 1.2.5
|
87
87
|
type: :runtime
|
88
88
|
prerelease: false
|
89
89
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -91,7 +91,7 @@ dependencies:
|
|
91
91
|
requirements:
|
92
92
|
- - ~>
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: 1.
|
94
|
+
version: 1.2.5
|
95
95
|
description: ! 'Wrong provides a general assert method that takes a predicate block.
|
96
96
|
Assertion failure
|
97
97
|
|
@@ -194,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: '0'
|
195
195
|
segments:
|
196
196
|
- 0
|
197
|
-
hash:
|
197
|
+
hash: 3247471355427996019
|
198
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
199
|
none: false
|
200
200
|
requirements:
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: '0'
|
204
204
|
segments:
|
205
205
|
- 0
|
206
|
-
hash:
|
206
|
+
hash: 3247471355427996019
|
207
207
|
requirements: []
|
208
208
|
rubyforge_project: wrong
|
209
209
|
rubygems_version: 1.8.24
|