virtus 0.0.2 → 0.0.3

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.
Files changed (85) hide show
  1. data/.gitignore +3 -0
  2. data/.rvmrc +1 -1
  3. data/Gemfile +20 -1
  4. data/History.txt +21 -0
  5. data/README.markdown +2 -2
  6. data/Rakefile +1 -2
  7. data/VERSION +1 -1
  8. data/config/flay.yml +3 -0
  9. data/config/flog.yml +2 -0
  10. data/config/roodi.yml +18 -0
  11. data/config/site.reek +91 -0
  12. data/config/yardstick.yml +2 -0
  13. data/lib/virtus.rb +51 -45
  14. data/lib/virtus/attribute.rb +301 -0
  15. data/lib/virtus/attribute/array.rb +17 -0
  16. data/lib/virtus/attribute/boolean.rb +60 -0
  17. data/lib/virtus/attribute/date.rb +35 -0
  18. data/lib/virtus/attribute/date_time.rb +34 -0
  19. data/lib/virtus/attribute/decimal.rb +24 -0
  20. data/lib/virtus/attribute/float.rb +33 -0
  21. data/lib/virtus/attribute/hash.rb +18 -0
  22. data/lib/virtus/attribute/integer.rb +30 -0
  23. data/lib/virtus/{attributes → attribute}/numeric.rb +2 -3
  24. data/lib/virtus/{attributes → attribute}/object.rb +2 -1
  25. data/lib/virtus/attribute/string.rb +31 -0
  26. data/lib/virtus/attribute/time.rb +34 -0
  27. data/lib/virtus/class_methods.rb +25 -8
  28. data/lib/virtus/instance_methods.rb +48 -9
  29. data/lib/virtus/support/chainable.rb +4 -6
  30. data/lib/virtus/typecast/boolean.rb +27 -0
  31. data/lib/virtus/typecast/numeric.rb +82 -0
  32. data/lib/virtus/typecast/time.rb +162 -0
  33. data/spec/integration/virtus/attributes/attribute/typecast_spec.rb +4 -4
  34. data/spec/integration/virtus/class_methods/attribute_spec.rb +1 -1
  35. data/spec/integration/virtus/class_methods/attributes_spec.rb +3 -2
  36. data/spec/integration/virtus/class_methods/const_missing_spec.rb +2 -2
  37. data/spec/rcov.opts +6 -0
  38. data/spec/spec_helper.rb +0 -9
  39. data/spec/unit/shared/attribute.rb +8 -8
  40. data/spec/unit/virtus/{attributes → attribute}/array_spec.rb +1 -1
  41. data/spec/unit/virtus/attribute/attribute_spec.rb +12 -0
  42. data/spec/unit/virtus/{attributes → attribute}/boolean_spec.rb +4 -4
  43. data/spec/unit/virtus/{attributes → attribute}/date_spec.rb +13 -7
  44. data/spec/unit/virtus/{attributes → attribute}/date_time_spec.rb +31 -10
  45. data/spec/unit/virtus/{attributes → attribute}/decimal_spec.rb +18 -18
  46. data/spec/unit/virtus/{attributes → attribute}/float_spec.rb +18 -18
  47. data/spec/unit/virtus/{attributes → attribute}/hash_spec.rb +1 -1
  48. data/spec/unit/virtus/{attributes → attribute}/integer_spec.rb +18 -18
  49. data/spec/unit/virtus/attribute/numeric/class_methods/descendants_spec.rb +15 -0
  50. data/spec/unit/virtus/attribute/object/class_methods/descendants_spec.rb +16 -0
  51. data/spec/unit/virtus/{attributes → attribute}/string_spec.rb +2 -2
  52. data/spec/unit/virtus/{attributes → attribute}/time_spec.rb +19 -9
  53. data/spec/unit/virtus/class_methods/new_spec.rb +7 -7
  54. data/spec/unit/virtus/determine_type_spec.rb +4 -4
  55. data/spec/unit/virtus/instance_methods/attribute_get_spec.rb +1 -1
  56. data/spec/unit/virtus/instance_methods/attribute_set_spec.rb +2 -2
  57. data/spec/unit/virtus/instance_methods/attributes_spec.rb +2 -2
  58. data/tasks/metrics/ci.rake +7 -0
  59. data/tasks/metrics/flay.rake +41 -0
  60. data/tasks/metrics/flog.rake +43 -0
  61. data/tasks/metrics/heckle.rake +261 -0
  62. data/tasks/metrics/metric_fu.rake +29 -0
  63. data/tasks/metrics/reek.rake +9 -0
  64. data/tasks/metrics/roodi.rake +15 -0
  65. data/tasks/metrics/yardstick.rake +23 -0
  66. data/tasks/spec.rake +26 -0
  67. data/tasks/yard.rake +9 -0
  68. data/virtus.gemspec +48 -33
  69. metadata +51 -41
  70. data/lib/virtus/attributes/array.rb +0 -8
  71. data/lib/virtus/attributes/attribute.rb +0 -214
  72. data/lib/virtus/attributes/boolean.rb +0 -39
  73. data/lib/virtus/attributes/date.rb +0 -44
  74. data/lib/virtus/attributes/date_time.rb +0 -43
  75. data/lib/virtus/attributes/decimal.rb +0 -24
  76. data/lib/virtus/attributes/float.rb +0 -20
  77. data/lib/virtus/attributes/hash.rb +0 -8
  78. data/lib/virtus/attributes/integer.rb +0 -20
  79. data/lib/virtus/attributes/string.rb +0 -11
  80. data/lib/virtus/attributes/time.rb +0 -45
  81. data/lib/virtus/attributes/typecast/numeric.rb +0 -32
  82. data/lib/virtus/attributes/typecast/time.rb +0 -27
  83. data/spec/unit/virtus/attributes/attribute_spec.rb +0 -13
  84. data/spec/unit/virtus/attributes/numeric/class_methods/descendants_spec.rb +0 -15
  85. data/spec/unit/virtus/attributes/object/class_methods/descendants_spec.rb +0 -16
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Virtus::Attribute do
4
+ describe '#typecast_to_primitive' do
5
+ let(:attribute) { Virtus::Attribute.new(:name) }
6
+ let(:value) { 'value' }
7
+
8
+ it "returns original value" do
9
+ attribute.typecast_to_primitive(value).should eql(value)
10
+ end
11
+ end
12
+ end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Virtus::Attributes::Boolean do
3
+ describe Virtus::Attribute::Boolean do
4
4
  it_should_behave_like 'Attribute' do
5
5
  let(:attribute_name) { :is_admin }
6
6
  let(:attribute_value) { true }
@@ -12,7 +12,7 @@ describe Virtus::Attributes::Boolean do
12
12
  Class.new do
13
13
  include Virtus
14
14
 
15
- attribute :is_admin, Virtus::Attributes::Boolean
15
+ attribute :is_admin, Virtus::Attribute::Boolean
16
16
  end
17
17
  end
18
18
 
@@ -25,7 +25,7 @@ describe Virtus::Attributes::Boolean do
25
25
 
26
26
  describe '#typecast' do
27
27
  let(:model) { Class.new { include Virtus } }
28
- let(:attribute) { model.attribute(:is_admin, Virtus::Attributes::Boolean) }
28
+ let(:attribute) { model.attribute(:is_admin, Virtus::Attribute::Boolean) }
29
29
 
30
30
  subject { attribute.typecast(value) }
31
31
 
@@ -91,7 +91,7 @@ describe Virtus::Attributes::Boolean do
91
91
 
92
92
  context "with 'Foo'" do
93
93
  let(:value) { 'Foo' }
94
- it { should == value }
94
+ it { should equal(value) }
95
95
  end
96
96
  end
97
97
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Virtus::Attributes::Date do
3
+ describe Virtus::Attribute::Date do
4
4
  it_should_behave_like 'Attribute' do
5
5
  let(:attribute_name) { :created_on }
6
6
  let(:attribute_value) { Date.today }
@@ -9,7 +9,7 @@ describe Virtus::Attributes::Date do
9
9
 
10
10
  describe '#typecast' do
11
11
  let(:model) { Class.new { include Virtus } }
12
- let(:attribute) { model.attribute(:bday, Virtus::Attributes::Date) }
12
+ let(:attribute) { model.attribute(:bday, Virtus::Attribute::Date) }
13
13
 
14
14
  let(:year) { 2011 }
15
15
  let(:month) { 4 }
@@ -19,9 +19,9 @@ describe Virtus::Attributes::Date do
19
19
 
20
20
  shared_examples_for "a correct date" do
21
21
  it { should be_kind_of(Date) }
22
- its(:year) { should == year }
23
- its(:month) { should == month }
24
- its(:day) { should == day }
22
+ its(:year) { should eql(year) }
23
+ its(:month) { should eql(month) }
24
+ its(:day) { should eql(day) }
25
25
  end
26
26
 
27
27
  context 'with a time' do
@@ -30,6 +30,12 @@ describe Virtus::Attributes::Date do
30
30
  end
31
31
  end
32
32
 
33
+ context 'with a date time' do
34
+ it_should_behave_like "a correct date" do
35
+ let(:value) { DateTime.new(year, month, day) }
36
+ end
37
+ end
38
+
33
39
  context 'with a hash' do
34
40
  it_should_behave_like "a correct date" do
35
41
  let(:value) do
@@ -44,9 +50,9 @@ describe Virtus::Attributes::Date do
44
50
  end
45
51
  end
46
52
 
47
- context 'with a on-date value' do
53
+ context 'with a non-date value' do
48
54
  let(:value) { 'non-date' }
49
- it { should == value }
55
+ it { should equal(value) }
50
56
  end
51
57
  end
52
58
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Virtus::Attributes::DateTime do
3
+ describe Virtus::Attribute::DateTime do
4
4
  it_should_behave_like 'Attribute' do
5
5
  let(:attribute_name) { :created_at }
6
6
  let(:attribute_value) { DateTime.now }
@@ -9,7 +9,7 @@ describe Virtus::Attributes::DateTime do
9
9
 
10
10
  describe '#typecast' do
11
11
  let(:model) { Class.new { include Virtus } }
12
- let(:attribute) { model.attribute(:bday, Virtus::Attributes::DateTime) }
12
+ let(:attribute) { model.attribute(:bday, Virtus::Attribute::DateTime) }
13
13
 
14
14
  let(:year) { 2011 }
15
15
  let(:month) { 4 }
@@ -21,13 +21,34 @@ describe Virtus::Attributes::DateTime do
21
21
  subject { attribute.typecast(value) }
22
22
 
23
23
  shared_examples_for "a correct date time" do
24
- it { should be_kind_of(DateTime) }
25
- its(:year) { should == year }
26
- its(:month) { should == month }
27
- its(:day) { should == day }
28
- its(:hour) { should == hour }
29
- its(:min) { should == min }
30
- its(:sec) { should == sec }
24
+ it { should be_kind_of(DateTime) }
25
+
26
+ its(:year) { should eql(year) }
27
+ its(:month) { should eql(month) }
28
+ its(:day) { should eql(day) }
29
+ its(:hour) { should eql(hour) }
30
+ its(:min) { should eql(min) }
31
+ its(:sec) { should eql(sec) }
32
+ end
33
+
34
+ context 'with a date' do
35
+ it_should_behave_like "a correct date time" do
36
+ let(:hour) { 0 }
37
+ let(:min) { 0 }
38
+ let(:sec) { 0 }
39
+
40
+ let(:value) do
41
+ Date.new(year, month, day)
42
+ end
43
+ end
44
+ end
45
+
46
+ context 'with a time' do
47
+ it_should_behave_like "a correct date time" do
48
+ let(:value) do
49
+ Time.local(year, month, day, hour, min, sec)
50
+ end
51
+ end
31
52
  end
32
53
 
33
54
  context 'with a hash' do
@@ -59,7 +80,7 @@ describe Virtus::Attributes::DateTime do
59
80
 
60
81
  context 'with a on-date value' do
61
82
  let(:value) { 'non-date' }
62
- it { should == value }
83
+ it { should equal(value) }
63
84
  end
64
85
  end
65
86
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Virtus::Attributes::Decimal do
3
+ describe Virtus::Attribute::Decimal do
4
4
  it_should_behave_like 'Attribute' do
5
5
  let(:attribute_name) { :price }
6
6
  let(:attribute_value) { BigDecimal("12.3456789") }
@@ -9,89 +9,89 @@ describe Virtus::Attributes::Decimal do
9
9
 
10
10
  describe '#typecast' do
11
11
  let(:model) { Class.new { include Virtus } }
12
- let(:attribute) { model.attribute(:price, Virtus::Attributes::Decimal) }
12
+ let(:attribute) { model.attribute(:price, Virtus::Attribute::Decimal) }
13
13
 
14
14
  subject { attribute.typecast(value) }
15
15
 
16
16
  context "with 24.0 big decimal" do
17
17
  let(:value) { BigDecimal('24.0') }
18
- it { should == value }
18
+ it { should eql(value) }
19
19
  end
20
20
 
21
21
  context 'with a zero string integer' do
22
22
  let(:value) { '0' }
23
- it { should == BigDecimal('0.0') }
23
+ it { should eql(BigDecimal('0.0')) }
24
24
  end
25
25
 
26
26
  context 'with a positive string integer' do
27
27
  let(:value) { '24' }
28
- it { should == BigDecimal('24.0') }
28
+ it { should eql(BigDecimal('24.0')) }
29
29
  end
30
30
 
31
31
  context 'with a negative string integer' do
32
32
  let(:value) { '-24' }
33
- it { should == BigDecimal('-24.0') }
33
+ it { should eql(BigDecimal('-24.0')) }
34
34
  end
35
35
 
36
36
  context 'with a zero string float' do
37
37
  let(:value) { '0.0' }
38
- it { should == BigDecimal('0.0') }
38
+ it { should eql(BigDecimal('0.0')) }
39
39
  end
40
40
 
41
41
  context 'with a positive string float' do
42
42
  let(:value) { '24.35' }
43
- it { should == BigDecimal('24.35') }
43
+ it { should eql(BigDecimal('24.35')) }
44
44
  end
45
45
 
46
46
  context 'with a negative string float' do
47
47
  let(:value) { '-24.35' }
48
- it { should == BigDecimal('-24.35') }
48
+ it { should eql(BigDecimal('-24.35')) }
49
49
  end
50
50
 
51
51
  context 'with a zero string float, with no leading digits' do
52
52
  let(:value) { '.0' }
53
- it { should == BigDecimal('0.0') }
53
+ it { should eql(BigDecimal('0.0')) }
54
54
  end
55
55
 
56
56
  context 'with a positive string float, with no leading digits' do
57
57
  let(:value) { '0.41' }
58
- it { should == BigDecimal('0.41') }
58
+ it { should eql(BigDecimal('0.41')) }
59
59
  end
60
60
 
61
61
  context 'with a zero integer' do
62
62
  let(:value) { 0 }
63
- it { should == BigDecimal('0.0') }
63
+ it { should eql(BigDecimal('0.0')) }
64
64
  end
65
65
 
66
66
  context 'with a positive integer' do
67
67
  let(:value) { 24 }
68
- it { should == BigDecimal('24.0') }
68
+ it { should eql(BigDecimal('24.0')) }
69
69
  end
70
70
 
71
71
  context 'with a negative integer' do
72
72
  let(:value) { -24 }
73
- it { should == BigDecimal('-24.0') }
73
+ it { should eql(BigDecimal('-24.0')) }
74
74
  end
75
75
 
76
76
  context 'with a zero float' do
77
77
  let(:value) { 0.0 }
78
- it { should == BigDecimal('0.0') }
78
+ it { should eql(BigDecimal('0.0')) }
79
79
  end
80
80
 
81
81
  context 'with a positive float' do
82
82
  let(:value) { 24.35 }
83
- it { should == BigDecimal('24.35') }
83
+ it { should eql(BigDecimal('24.35')) }
84
84
  end
85
85
 
86
86
  context 'with a negative float' do
87
87
  let(:value) { -24.35 }
88
- it { should == BigDecimal('-24.35') }
88
+ it { should eql(BigDecimal('-24.35')) }
89
89
  end
90
90
 
91
91
  [ Object.new, true, '00.0', '0.', '-.0', 'string' ].each do |non_num_value|
92
92
  context "with a non-numeric value = #{non_num_value.inspect}" do
93
93
  let(:value) { non_num_value }
94
- it { should == non_num_value }
94
+ it { should equal(non_num_value) }
95
95
  end
96
96
  end
97
97
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Virtus::Attributes::Float do
3
+ describe Virtus::Attribute::Float do
4
4
  it_should_behave_like 'Attribute' do
5
5
  let(:attribute_name) { :score }
6
6
  let(:attribute_value) { 12.34 }
@@ -9,89 +9,89 @@ describe Virtus::Attributes::Float do
9
9
 
10
10
  describe '#typecast' do
11
11
  let(:model) { Class.new { include Virtus } }
12
- let(:attribute) { model.attribute(:score, Virtus::Attributes::Float) }
12
+ let(:attribute) { model.attribute(:score, Virtus::Attribute::Float) }
13
13
 
14
14
  subject { attribute.typecast(value) }
15
15
 
16
16
  context "with a float" do
17
17
  let(:value) { 24.0 }
18
- it { should == value }
18
+ it { should eql(value) }
19
19
  end
20
20
 
21
21
  context 'with a zero string integer' do
22
22
  let(:value) { '0' }
23
- it { should == 0.0 }
23
+ it { should eql(0.0) }
24
24
  end
25
25
 
26
26
  context 'with a positive string integer' do
27
27
  let(:value) { '24' }
28
- it { should == 24.0 }
28
+ it { should eql(24.0) }
29
29
  end
30
30
 
31
31
  context 'with a negative string integer' do
32
32
  let(:value) { '-24' }
33
- it { should == -24.0 }
33
+ it { should eql(-24.0) }
34
34
  end
35
35
 
36
36
  context 'with a zero string float' do
37
37
  let(:value) { '0.0' }
38
- it { should == 0.0 }
38
+ it { should eql(0.0) }
39
39
  end
40
40
 
41
41
  context 'with a positive string float' do
42
42
  let(:value) { '24.35' }
43
- it { should == 24.35 }
43
+ it { should eql(24.35) }
44
44
  end
45
45
 
46
46
  context 'with a negative string float' do
47
47
  let(:value) { '-24.35' }
48
- it { should == -24.35 }
48
+ it { should eql(-24.35) }
49
49
  end
50
50
 
51
51
  context 'with a zero string float, with no leading digits' do
52
52
  let(:value) { '.0' }
53
- it { should == 0.0 }
53
+ it { should eql(0.0) }
54
54
  end
55
55
 
56
56
  context 'with a positive string float, with no leading digits' do
57
57
  let(:value) { '.41' }
58
- it { should == 0.41 }
58
+ it { should eql(0.41) }
59
59
  end
60
60
 
61
61
  context 'with a zero integer' do
62
62
  let(:value) { 0 }
63
- it { should == 0.0 }
63
+ it { should eql(0.0) }
64
64
  end
65
65
 
66
66
  context 'with a positive integer' do
67
67
  let(:value) { 24 }
68
- it { should == 24.0 }
68
+ it { should eql(24.0) }
69
69
  end
70
70
 
71
71
  context 'with a negative integer' do
72
72
  let(:value) { -24 }
73
- it { should == -24.0 }
73
+ it { should eql(-24.0) }
74
74
  end
75
75
 
76
76
  context 'with a zero decimal' do
77
77
  let(:value) { BigDecimal('0.0') }
78
- it { should == 0.0 }
78
+ it { should eql(0.0) }
79
79
  end
80
80
 
81
81
  context 'with a positive decimal' do
82
82
  let(:value) { BigDecimal('24.35') }
83
- it { should == 24.35 }
83
+ it { should eql(24.35) }
84
84
  end
85
85
 
86
86
  context 'with a negative decimal' do
87
87
  let(:value) { BigDecimal('-24.35') }
88
- it { should == -24.35 }
88
+ it { should eql(-24.35) }
89
89
  end
90
90
 
91
91
  [ Object.new, true, '00.0', '0.', '-.0', 'string' ].each do |non_num_value|
92
92
  context "does not typecast non-numeric value #{non_num_value.inspect}" do
93
93
  let(:value) { non_num_value }
94
- it { should == non_num_value }
94
+ it { should equal(non_num_value) }
95
95
  end
96
96
  end
97
97
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Virtus::Attributes::Hash do
3
+ describe Virtus::Attribute::Hash do
4
4
  it_should_behave_like 'Attribute' do
5
5
  let(:attribute_name) { :settings }
6
6
  let(:attribute_value) { Hash[:one => 1] }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Virtus::Attributes::Integer do
3
+ describe Virtus::Attribute::Integer do
4
4
  it_should_behave_like 'Attribute' do
5
5
  let(:attribute_name) { :age }
6
6
  let(:attribute_value) { 28 }
@@ -9,89 +9,89 @@ describe Virtus::Attributes::Integer do
9
9
 
10
10
  describe '#typecast' do
11
11
  let(:model) { Class.new { include Virtus } }
12
- let(:attribute) { model.attribute(:age, Virtus::Attributes::Integer) }
12
+ let(:attribute) { model.attribute(:age, Virtus::Attribute::Integer) }
13
13
 
14
14
  subject { attribute.typecast(value) }
15
15
 
16
16
  context "with an integer" do
17
17
  let(:value) { 24 }
18
- it { should == value }
18
+ it { should eql(value) }
19
19
  end
20
20
 
21
21
  context 'with a zero string integer' do
22
22
  let(:value) { 24 }
23
- it { should == value }
23
+ it { should eql(value) }
24
24
  end
25
25
 
26
26
  context 'with a positive string integer' do
27
27
  let(:value) { '24' }
28
- it { should == 24 }
28
+ it { should eql(24) }
29
29
  end
30
30
 
31
31
  context 'with a negative string integer' do
32
32
  let(:value) { '-24' }
33
- it { should == -24 }
33
+ it { should eql(-24) }
34
34
  end
35
35
 
36
36
  context 'with a zero string float' do
37
37
  let(:value) { 0.0 }
38
- it { should == 0 }
38
+ it { should eql(0) }
39
39
  end
40
40
 
41
41
  context 'with a positive string float' do
42
42
  let(:value) { '24.35' }
43
- it { should == 24 }
43
+ it { should eql(24) }
44
44
  end
45
45
 
46
46
  context 'with a negative string float' do
47
47
  let(:value) { '-24.35' }
48
- it { should == -24 }
48
+ it { should eql(-24) }
49
49
  end
50
50
 
51
51
  context 'with a zero string float, with no leading digits' do
52
52
  let(:value) { '.0' }
53
- it { should == 0 }
53
+ it { should eql(0) }
54
54
  end
55
55
 
56
56
  context 'with a positive string float, with no leading digits' do
57
57
  let(:value) { '.41' }
58
- it { should == 0 }
58
+ it { should eql(0) }
59
59
  end
60
60
 
61
61
  context 'with a zero float' do
62
62
  let(:value) { 0.0 }
63
- it { should == 0 }
63
+ it { should eql(0) }
64
64
  end
65
65
 
66
66
  context 'with a positive float' do
67
67
  let(:value) { 24.35 }
68
- it { should == 24 }
68
+ it { should eql(24) }
69
69
  end
70
70
 
71
71
  context 'with a negative float' do
72
72
  let(:value) { -24.35 }
73
- it { should == -24 }
73
+ it { should eql(-24) }
74
74
  end
75
75
 
76
76
  context 'with a zero decimal' do
77
77
  let(:value) { BigDecimal('0.0') }
78
- it { should == 0 }
78
+ it { should eql(0) }
79
79
  end
80
80
 
81
81
  context 'with a positive decimal' do
82
82
  let(:value) { BigDecimal('24.35') }
83
- it { should == 24 }
83
+ it { should eql(24) }
84
84
  end
85
85
 
86
86
  context 'with a negative decimal' do
87
87
  let(:value) { BigDecimal('-24.35') }
88
- it { should == -24 }
88
+ it { should eql(-24) }
89
89
  end
90
90
 
91
91
  [ Object.new, true, '00.0', '0.', '-.0', 'string' ].each do |non_num_value|
92
92
  context "does not typecast non-numeric value #{non_num_value.inspect}" do
93
93
  let(:value) { non_num_value }
94
- it { should == non_num_value }
94
+ it { should equal(non_num_value) }
95
95
  end
96
96
  end
97
97
  end