active_attr 0.13.0 → 0.15.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of active_attr might be problematic. Click here for more details.

Files changed (45) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yaml +180 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +34 -0
  5. data/Gemfile +6 -8
  6. data/README.md +145 -117
  7. data/active_attr.gemspec +14 -7
  8. data/gemfiles/rails_3_0.gemfile +0 -4
  9. data/gemfiles/rails_3_1.gemfile +1 -8
  10. data/gemfiles/rails_3_2.gemfile +1 -12
  11. data/gemfiles/rails_4_0.gemfile +1 -1
  12. data/gemfiles/rails_4_1.gemfile +1 -1
  13. data/gemfiles/rails_4_2.gemfile +1 -1
  14. data/gemfiles/rails_5_0.gemfile +2 -1
  15. data/gemfiles/rails_5_1.gemfile +2 -1
  16. data/gemfiles/rails_5_2.gemfile +10 -0
  17. data/gemfiles/rails_6_0.gemfile +10 -0
  18. data/gemfiles/rails_head.gemfile +3 -2
  19. data/lib/active_attr.rb +1 -1
  20. data/lib/active_attr/attributes.rb +63 -9
  21. data/lib/active_attr/chainable_initialization.rb +2 -6
  22. data/lib/active_attr/logger.rb +1 -1
  23. data/lib/active_attr/mass_assignment.rb +2 -2
  24. data/lib/active_attr/matchers/have_attribute_matcher.rb +1 -1
  25. data/lib/active_attr/model.rb +1 -0
  26. data/lib/active_attr/query_attributes.rb +1 -1
  27. data/lib/active_attr/railtie.rb +5 -0
  28. data/lib/active_attr/typecasting/big_decimal_typecaster.rb +3 -0
  29. data/lib/active_attr/typecasting/boolean_typecaster.rb +8 -0
  30. data/lib/active_attr/typecasting/float_typecaster.rb +3 -1
  31. data/lib/active_attr/typecasting/integer_typecaster.rb +3 -1
  32. data/lib/active_attr/version.rb +1 -1
  33. data/spec/functional/active_attr/attributes_spec.rb +8 -40
  34. data/spec/functional/active_attr/mass_assignment_spec.rb +2 -2
  35. data/spec/functional/active_attr/matchers/have_attribute_matcher_spec.rb +48 -0
  36. data/spec/functional/active_attr/model_spec.rb +47 -0
  37. data/spec/unit/active_attr/attribute_defaults_spec.rb +8 -0
  38. data/spec/unit/active_attr/attributes_spec.rb +91 -0
  39. data/spec/unit/active_attr/typecasting/big_decimal_typecaster_spec.rb +11 -3
  40. data/spec/unit/active_attr/typecasting/boolean_typecaster_spec.rb +3 -3
  41. data/spec/unit/active_attr/typecasting/float_typecaster_spec.rb +10 -2
  42. data/spec/unit/active_attr/typecasting/integer_typecaster_spec.rb +10 -2
  43. metadata +48 -33
  44. data/.ruby-version +0 -1
  45. data/.travis.yml +0 -94
@@ -12,14 +12,22 @@ module ActiveAttr
12
12
  typecaster.call(value).should equal value
13
13
  end
14
14
 
15
- it "casts nil to 0.0" do
16
- typecaster.call(nil).should eql 0.0
15
+ it "casts nil to nil" do
16
+ typecaster.call(nil).should eql nil
17
17
  end
18
18
 
19
19
  it "returns the float version of a String" do
20
20
  typecaster.call("2").should eql 2.0
21
21
  end
22
22
 
23
+ it "casts an empty String to nil" do
24
+ typecaster.call("").should eql nil
25
+ end
26
+
27
+ it "casts an alpha String to a zero Float" do
28
+ typecaster.call("bob").should eql 0.0
29
+ end
30
+
23
31
  it "returns nil for an object that does not respond to #to_f" do
24
32
  typecaster.call(Object.new).should be_nil
25
33
  end
@@ -12,14 +12,22 @@ module ActiveAttr
12
12
  typecaster.call(value).should equal value
13
13
  end
14
14
 
15
- it "casts nil to 0" do
16
- typecaster.call(nil).should eql 0
15
+ it "casts nil to nil" do
16
+ typecaster.call(nil).should eql nil
17
17
  end
18
18
 
19
19
  it "returns the integer version of a String" do
20
20
  typecaster.call("2").should eql 2
21
21
  end
22
22
 
23
+ it "casts an empty String to nil" do
24
+ typecaster.call("").should eql nil
25
+ end
26
+
27
+ it "casts an alpha String to a zero Integer" do
28
+ typecaster.call("bob").should eql 0
29
+ end
30
+
23
31
  it "returns nil for an object that does not respond to #to_i" do
24
32
  typecaster.call(Object.new).should be_nil
25
33
  end
metadata CHANGED
@@ -1,16 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_attr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Griego
8
8
  - Ben Poweski
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-06 00:00:00.000000000 Z
12
+ date: 2021-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: actionpack
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 3.0.2
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '7.0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: 3.0.2
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '7.0'
14
34
  - !ruby/object:Gem::Dependency
15
35
  name: activemodel
16
36
  requirement: !ruby/object:Gem::Requirement
@@ -20,7 +40,7 @@ dependencies:
20
40
  version: 3.0.2
21
41
  - - "<"
22
42
  - !ruby/object:Gem::Version
23
- version: '6.0'
43
+ version: '7.0'
24
44
  type: :runtime
25
45
  prerelease: false
26
46
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +50,7 @@ dependencies:
30
50
  version: 3.0.2
31
51
  - - "<"
32
52
  - !ruby/object:Gem::Version
33
- version: '6.0'
53
+ version: '7.0'
34
54
  - !ruby/object:Gem::Dependency
35
55
  name: activesupport
36
56
  requirement: !ruby/object:Gem::Requirement
@@ -40,7 +60,7 @@ dependencies:
40
60
  version: 3.0.2
41
61
  - - "<"
42
62
  - !ruby/object:Gem::Version
43
- version: '6.0'
63
+ version: '7.0'
44
64
  type: :runtime
45
65
  prerelease: false
46
66
  version_requirements: !ruby/object:Gem::Requirement
@@ -50,28 +70,25 @@ dependencies:
50
70
  version: 3.0.2
51
71
  - - "<"
52
72
  - !ruby/object:Gem::Version
53
- version: '6.0'
73
+ version: '7.0'
54
74
  - !ruby/object:Gem::Dependency
55
75
  name: bundler
56
76
  requirement: !ruby/object:Gem::Requirement
57
77
  requirements:
58
- - - "~>"
78
+ - - ">="
59
79
  - !ruby/object:Gem::Version
60
- version: '1.0'
80
+ version: '0'
61
81
  type: :development
62
82
  prerelease: false
63
83
  version_requirements: !ruby/object:Gem::Requirement
64
84
  requirements:
65
- - - "~>"
85
+ - - ">="
66
86
  - !ruby/object:Gem::Version
67
- version: '1.0'
87
+ version: '0'
68
88
  - !ruby/object:Gem::Dependency
69
- name: factory_girl
89
+ name: factory_bot
70
90
  requirement: !ruby/object:Gem::Requirement
71
91
  requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '2.2'
75
92
  - - "<"
76
93
  - !ruby/object:Gem::Version
77
94
  version: '5.0'
@@ -79,9 +96,6 @@ dependencies:
79
96
  prerelease: false
80
97
  version_requirements: !ruby/object:Gem::Requirement
81
98
  requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: '2.2'
85
99
  - - "<"
86
100
  - !ruby/object:Gem::Version
87
101
  version: '5.0'
@@ -108,7 +122,7 @@ dependencies:
108
122
  version: 0.9.0
109
123
  - - "<"
110
124
  - !ruby/object:Gem::Version
111
- version: '10.6'
125
+ version: '13.1'
112
126
  type: :development
113
127
  prerelease: false
114
128
  version_requirements: !ruby/object:Gem::Requirement
@@ -118,7 +132,7 @@ dependencies:
118
132
  version: 0.9.0
119
133
  - - "<"
120
134
  - !ruby/object:Gem::Version
121
- version: '10.6'
135
+ version: '13.1'
122
136
  - !ruby/object:Gem::Dependency
123
137
  name: rspec
124
138
  requirement: !ruby/object:Gem::Requirement
@@ -137,17 +151,17 @@ dependencies:
137
151
  name: tzinfo
138
152
  requirement: !ruby/object:Gem::Requirement
139
153
  requirements:
140
- - - "<"
154
+ - - ">="
141
155
  - !ruby/object:Gem::Version
142
- version: '2.0'
156
+ version: '0'
143
157
  type: :development
144
158
  prerelease: false
145
159
  version_requirements: !ruby/object:Gem::Requirement
146
160
  requirements:
147
- - - "<"
161
+ - - ">="
148
162
  - !ruby/object:Gem::Version
149
- version: '2.0'
150
- description: Create plain old ruby models without reinventing the wheel.
163
+ version: '0'
164
+ description: Create plain old Ruby models without reinventing the wheel.
151
165
  email:
152
166
  - cgriego@gmail.com
153
167
  - bpoweski@gmail.com
@@ -155,10 +169,9 @@ executables: []
155
169
  extensions: []
156
170
  extra_rdoc_files: []
157
171
  files:
172
+ - ".github/workflows/test.yaml"
158
173
  - ".gitignore"
159
174
  - ".rspec"
160
- - ".ruby-version"
161
- - ".travis.yml"
162
175
  - ".yardopts"
163
176
  - CHANGELOG.md
164
177
  - Gemfile
@@ -175,6 +188,8 @@ files:
175
188
  - gemfiles/rails_4_2.gemfile
176
189
  - gemfiles/rails_5_0.gemfile
177
190
  - gemfiles/rails_5_1.gemfile
191
+ - gemfiles/rails_5_2.gemfile
192
+ - gemfiles/rails_6_0.gemfile
178
193
  - gemfiles/rails_head.gemfile
179
194
  - lib/active_attr.rb
180
195
  - lib/active_attr/attribute_defaults.rb
@@ -251,8 +266,9 @@ files:
251
266
  homepage: https://github.com/cgriego/active_attr
252
267
  licenses:
253
268
  - MIT
254
- metadata: {}
255
- post_install_message:
269
+ metadata:
270
+ changelog_uri: https://github.com/cgriego/active_attr/blob/master/CHANGELOG.md
271
+ post_install_message:
256
272
  rdoc_options: []
257
273
  require_paths:
258
274
  - lib
@@ -260,16 +276,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
260
276
  requirements:
261
277
  - - ">="
262
278
  - !ruby/object:Gem::Version
263
- version: '0'
279
+ version: 2.1.0
264
280
  required_rubygems_version: !ruby/object:Gem::Requirement
265
281
  requirements:
266
282
  - - ">="
267
283
  - !ruby/object:Gem::Version
268
284
  version: '0'
269
285
  requirements: []
270
- rubyforge_project:
271
- rubygems_version: 2.6.12
272
- signing_key:
286
+ rubygems_version: 3.1.2
287
+ signing_key:
273
288
  specification_version: 4
274
289
  summary: What ActiveModel left out
275
290
  test_files:
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.4.1
data/.travis.yml DELETED
@@ -1,94 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- rvm:
4
- - ree
5
- - 1.9.2
6
- - 1.9.3
7
- - 2.0.0
8
- - 2.1.10
9
- - 2.2.10
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'
17
- bundler_args: --without development
18
- gemfile:
19
- - gemfiles/rails_3_0.gemfile
20
- - gemfiles/rails_3_1.gemfile
21
- - gemfiles/rails_3_2.gemfile
22
- - gemfiles/rails_4_0.gemfile
23
- - gemfiles/rails_4_1.gemfile
24
- - gemfiles/rails_4_2.gemfile
25
- - gemfiles/rails_5_0.gemfile
26
- - gemfiles/rails_5_1.gemfile
27
- - Gemfile
28
- - gemfiles/rails_head.gemfile
29
- matrix:
30
- allow_failures:
31
- - gemfile: gemfiles/rails_head.gemfile
32
- exclude:
33
- - rvm: 2.5.5
34
- gemfile: gemfiles/rails_3_0.gemfile
35
- - rvm: 2.6.2
36
- gemfile: gemfiles/rails_3_0.gemfile
37
- - rvm: ree
38
- gemfile: gemfiles/rails_4_0.gemfile
39
- - rvm: 1.9.2
40
- gemfile: gemfiles/rails_4_0.gemfile
41
- - rvm: ree
42
- gemfile: gemfiles/rails_4_1.gemfile
43
- - rvm: 1.9.2
44
- gemfile: gemfiles/rails_4_1.gemfile
45
- - rvm: ree
46
- gemfile: gemfiles/rails_4_2.gemfile
47
- - rvm: 1.9.2
48
- gemfile: gemfiles/rails_4_2.gemfile
49
- - rvm: ree
50
- gemfile: gemfiles/rails_5_0.gemfile
51
- - rvm: 1.9.2
52
- gemfile: gemfiles/rails_5_0.gemfile
53
- - rvm: 1.9.3
54
- gemfile: gemfiles/rails_5_0.gemfile
55
- - rvm: 2.0.0
56
- gemfile: gemfiles/rails_5_0.gemfile
57
- - rvm: 2.1.10
58
- gemfile: gemfiles/rails_5_0.gemfile
59
- - rvm: ree
60
- gemfile: gemfiles/rails_5_1.gemfile
61
- - rvm: 1.9.2
62
- gemfile: gemfiles/rails_5_1.gemfile
63
- - rvm: 1.9.3
64
- gemfile: gemfiles/rails_5_1.gemfile
65
- - rvm: 2.0.0
66
- gemfile: gemfiles/rails_5_1.gemfile
67
- - rvm: 2.1.10
68
- gemfile: gemfiles/rails_5_1.gemfile
69
- - rvm: ree
70
- gemfile: Gemfile
71
- - rvm: 1.9.2
72
- gemfile: Gemfile
73
- - rvm: 1.9.3
74
- gemfile: Gemfile
75
- - rvm: 2.0.0
76
- gemfile: Gemfile
77
- - rvm: 2.1.10
78
- gemfile: Gemfile
79
- - rvm: ree
80
- gemfile: gemfiles/rails_head.gemfile
81
- - rvm: 1.9.2
82
- gemfile: gemfiles/rails_head.gemfile
83
- - rvm: 1.9.3
84
- gemfile: gemfiles/rails_head.gemfile
85
- - rvm: 2.0.0
86
- gemfile: gemfiles/rails_head.gemfile
87
- - rvm: 2.1.10
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