active_attr 0.12.0 → 0.13.0
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.
Potentially problematic release.
This version of active_attr might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +16 -5
- data/CHANGELOG.md +4 -0
- data/active_attr.gemspec +1 -1
- data/lib/active_attr/typecasting/big_decimal_typecaster.rb +2 -2
- data/lib/active_attr/version.rb +1 -1
- data/spec/functional/active_attr/typecasted_attributes_spec.rb +1 -1
- data/spec/unit/active_attr/query_attributes_spec.rb +4 -4
- data/spec/unit/active_attr/typecasting/big_decimal_typecaster_spec.rb +7 -7
- data/spec/unit/active_attr/typecasting/boolean_typecaster_spec.rb +4 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51278f667fa7e613cd46655c1f19970f66740fb0
|
4
|
+
data.tar.gz: cb9db1fa72766751d76ed10ac783bb301f3f7ca8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 468c65ec0ee598cd5371e1fb176edb280e6ac06d8d81a66c7a3660062e431633e01f3e2ea597c6a115ab983bfc98e2d04c8b071d0792f744380bfc5048b4ddb9
|
7
|
+
data.tar.gz: c44da46b5e82fa1dbcd2b9ca698a4f800c5a488319b316cc2f63605449e123cb20d4bbdd64f4f6abe0f967997afe9cdce60cdfd611212937c323ef188549e108
|
data/.travis.yml
CHANGED
@@ -7,10 +7,13 @@ rvm:
|
|
7
7
|
- 2.0.0
|
8
8
|
- 2.1.10
|
9
9
|
- 2.2.10
|
10
|
-
- 2.3.
|
11
|
-
- 2.4.
|
12
|
-
- 2.5.
|
13
|
-
|
10
|
+
- 2.3.8
|
11
|
+
- 2.4.6
|
12
|
+
- 2.5.5
|
13
|
+
- 2.6.2
|
14
|
+
before_install:
|
15
|
+
- travis_retry gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
16
|
+
- travis_retry gem install bundler -v '< 2'
|
14
17
|
bundler_args: --without development
|
15
18
|
gemfile:
|
16
19
|
- gemfiles/rails_3_0.gemfile
|
@@ -27,7 +30,9 @@ matrix:
|
|
27
30
|
allow_failures:
|
28
31
|
- gemfile: gemfiles/rails_head.gemfile
|
29
32
|
exclude:
|
30
|
-
- rvm: 2.5.
|
33
|
+
- rvm: 2.5.5
|
34
|
+
gemfile: gemfiles/rails_3_0.gemfile
|
35
|
+
- rvm: 2.6.2
|
31
36
|
gemfile: gemfiles/rails_3_0.gemfile
|
32
37
|
- rvm: ree
|
33
38
|
gemfile: gemfiles/rails_4_0.gemfile
|
@@ -81,3 +86,9 @@ matrix:
|
|
81
86
|
gemfile: gemfiles/rails_head.gemfile
|
82
87
|
- rvm: 2.1.10
|
83
88
|
gemfile: gemfiles/rails_head.gemfile
|
89
|
+
- rvm: 2.2.10
|
90
|
+
gemfile: gemfiles/rails_head.gemfile
|
91
|
+
- rvm: 2.3.8
|
92
|
+
gemfile: gemfiles/rails_head.gemfile
|
93
|
+
- rvm: 2.4.6
|
94
|
+
gemfile: gemfiles/rails_head.gemfile
|
data/CHANGELOG.md
CHANGED
data/active_attr.gemspec
CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.add_development_dependency "minitest"
|
25
25
|
gem.add_development_dependency "rake", ">= 0.9.0", "< 10.6"
|
26
26
|
gem.add_development_dependency "rspec", "~> 3.0"
|
27
|
-
gem.add_development_dependency "tzinfo"
|
27
|
+
gem.add_development_dependency "tzinfo", "< 2.0"
|
28
28
|
end
|
data/lib/active_attr/version.rb
CHANGED
@@ -100,7 +100,7 @@ module ActiveAttr
|
|
100
100
|
|
101
101
|
it "a BigDecimal attribute returns a BigDecimal" do
|
102
102
|
model.big_decimal = "1.1"
|
103
|
-
model.big_decimal.should eql BigDecimal
|
103
|
+
model.big_decimal.should eql BigDecimal("1.1")
|
104
104
|
end
|
105
105
|
|
106
106
|
it "a Boolean attribute returns a Boolean" do
|
@@ -112,12 +112,12 @@ module ActiveAttr
|
|
112
112
|
end
|
113
113
|
|
114
114
|
it "is false when the attribute is a zero BigDecimal" do
|
115
|
-
model.value = BigDecimal
|
115
|
+
model.value = BigDecimal("0.0")
|
116
116
|
model.value?.should == false
|
117
117
|
end
|
118
118
|
|
119
119
|
it "is true when the attribute is a non-zero BigDecimal" do
|
120
|
-
model.value = BigDecimal
|
120
|
+
model.value = BigDecimal("0.1")
|
121
121
|
model.value?.should == true
|
122
122
|
end
|
123
123
|
|
@@ -137,12 +137,12 @@ module ActiveAttr
|
|
137
137
|
end
|
138
138
|
|
139
139
|
it "is false when the attribute is a negative zero BigDecimal" do
|
140
|
-
model.value = BigDecimal
|
140
|
+
model.value = BigDecimal("-0.0")
|
141
141
|
model.value?.should == false
|
142
142
|
end
|
143
143
|
|
144
144
|
it "is true when the attribute is a negative BigDecimal" do
|
145
|
-
model.value = BigDecimal
|
145
|
+
model.value = BigDecimal("-0.1")
|
146
146
|
model.value?.should == true
|
147
147
|
end
|
148
148
|
|
@@ -8,32 +8,32 @@ module ActiveAttr
|
|
8
8
|
|
9
9
|
describe "#call" do
|
10
10
|
it "returns the original BigDecimal for a BigDecimal" do
|
11
|
-
value = BigDecimal
|
11
|
+
value = BigDecimal("2.0")
|
12
12
|
typecaster.call(value).should equal value
|
13
13
|
end
|
14
14
|
|
15
15
|
it "casts nil to a zero BigDecimal" do
|
16
|
-
typecaster.call(nil).should eql BigDecimal
|
16
|
+
typecaster.call(nil).should eql BigDecimal("0.0")
|
17
17
|
end
|
18
18
|
|
19
19
|
it "casts a numeric String to a BigDecimal" do
|
20
|
-
typecaster.call("2").should eql BigDecimal
|
20
|
+
typecaster.call("2").should eql BigDecimal("2.0")
|
21
21
|
end
|
22
22
|
|
23
23
|
it "casts a alpha String to a zero BigDecimal" do
|
24
|
-
typecaster.call("bob").should eql BigDecimal
|
24
|
+
typecaster.call("bob").should eql BigDecimal("0.0")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "casts a Rational to a BigDecimal" do
|
28
|
-
typecaster.call(Rational(1, 2)).should eql BigDecimal
|
28
|
+
typecaster.call(Rational(1, 2)).should eql BigDecimal("0.5")
|
29
29
|
end
|
30
30
|
|
31
31
|
it "casts a Float to a BigDecimal" do
|
32
|
-
typecaster.call(1.2).should eql BigDecimal
|
32
|
+
typecaster.call(1.2).should eql BigDecimal("1.2")
|
33
33
|
end
|
34
34
|
|
35
35
|
it "cases an Integer to a BigDecimal" do
|
36
|
-
typecaster.call(2).should eql BigDecimal
|
36
|
+
typecaster.call(2).should eql BigDecimal("2.0")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -94,11 +94,11 @@ module ActiveAttr
|
|
94
94
|
end
|
95
95
|
|
96
96
|
it "casts a zero BigDecimal to false" do
|
97
|
-
typecaster.call(BigDecimal
|
97
|
+
typecaster.call(BigDecimal("0.0")).should equal false
|
98
98
|
end
|
99
99
|
|
100
100
|
it "casts a non-zero BigDecimal to true" do
|
101
|
-
typecaster.call(BigDecimal
|
101
|
+
typecaster.call(BigDecimal("0.1")).should equal true
|
102
102
|
end
|
103
103
|
|
104
104
|
it "casts -1 to true" do
|
@@ -114,11 +114,11 @@ module ActiveAttr
|
|
114
114
|
end
|
115
115
|
|
116
116
|
it "casts a negative zero BigDecimal to false" do
|
117
|
-
typecaster.call(BigDecimal
|
117
|
+
typecaster.call(BigDecimal("-0.0")).should equal false
|
118
118
|
end
|
119
119
|
|
120
120
|
it "casts a negative BigDecimal to true" do
|
121
|
-
typecaster.call(BigDecimal
|
121
|
+
typecaster.call(BigDecimal("-0.1")).should equal true
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_attr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Griego
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-04-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -137,16 +137,16 @@ dependencies:
|
|
137
137
|
name: tzinfo
|
138
138
|
requirement: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- - "
|
140
|
+
- - "<"
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: '0'
|
142
|
+
version: '2.0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
145
|
version_requirements: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
|
-
- - "
|
147
|
+
- - "<"
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
149
|
+
version: '2.0'
|
150
150
|
description: Create plain old ruby models without reinventing the wheel.
|
151
151
|
email:
|
152
152
|
- cgriego@gmail.com
|