null_and_void 1.1.4 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
data/spec/convertible_spec.rb
CHANGED
@@ -25,6 +25,11 @@ describe NullAndVoid::Convertible do
|
|
25
25
|
null_object.to_int.should be_zero
|
26
26
|
end
|
27
27
|
|
28
|
+
it 'is zero when the attempt is made to convert it to a Complex number' do
|
29
|
+
null_object.to_c.should be_a Complex
|
30
|
+
null_object.to_c.should be_zero
|
31
|
+
end
|
32
|
+
|
28
33
|
it 'is zero when the attempt is made to convert it to a Float' do
|
29
34
|
null_object.to_f.should be_a Float
|
30
35
|
null_object.to_f.should be_zero
|
@@ -33,6 +38,9 @@ describe NullAndVoid::Convertible do
|
|
33
38
|
it 'is zero when the attempt is made to convert it to a Rational' do
|
34
39
|
null_object.to_r.should be_a Rational
|
35
40
|
null_object.to_r.should be_zero
|
41
|
+
|
42
|
+
null_object.rationalize.should be_a Rational
|
43
|
+
null_object.rationalize.should be_zero
|
36
44
|
end
|
37
45
|
|
38
46
|
it 'is an empty Array when the attempt is made to convert it to an Array' do
|
data/spec/introspectable_spec.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
require 'rspectacular'
|
2
2
|
require 'null_and_void/introspectable'
|
3
3
|
|
4
|
-
class
|
4
|
+
class MyNullObject
|
5
5
|
include NullAndVoid::Introspectable
|
6
6
|
end
|
7
7
|
|
8
8
|
describe NullAndVoid::Introspectable do
|
9
|
-
let(:null_object) {
|
9
|
+
let(:null_object) { MyNullObject.new }
|
10
10
|
|
11
11
|
it 'knows it is a null object' do
|
12
12
|
null_object.should be_null_object
|
13
13
|
end
|
14
|
+
|
15
|
+
it 'can inspect itself' do
|
16
|
+
null_object.inspect.should match /\A#<MyNullObject:0x[a-f0-9]{12}>\z/
|
17
|
+
end
|
14
18
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: null_and_void
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.
|
5
|
+
version: '1.2'
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- jfelchner
|
@@ -52,13 +52,13 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '0.
|
55
|
+
version: '0.11'
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.11'
|
62
62
|
description: Makes generating Null Objects easy.
|
63
63
|
email: accounts+git@thekompanee.com
|
64
64
|
executables: []
|