active_type 0.3.3 → 0.3.4
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.
- checksums.yaml +4 -4
- data/gemfiles/Gemfile.4.2.1 +7 -0
- data/gemfiles/Gemfile.4.2.1.lock +49 -0
- data/lib/active_type/version.rb +1 -1
- data/lib/active_type/virtual_attributes.rb +9 -0
- data/spec/active_type/object_spec.rb +13 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66429d47723c86d46ad8206672d42d9c082cc337
|
4
|
+
data.tar.gz: 0f11c8ceba00e27e856f38e04bf9e02ff84e30cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73276f4bded38cc46e7f4e92d707440f5cebefa2e84c9520577469dd4e9c55fbd6a30965525ec20cd657af5c7d4e12e3a601e2ee9087b397b253880d3a6904bd
|
7
|
+
data.tar.gz: 16fd9adac6c2d729391db29a9535c47e7534dffbb5d2e9953d2ed190aa21ffbd06f016a8548e64ab17b46d0a3aff194a3929a0973630d326e7fed9114ccefde9
|
@@ -0,0 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
active_type (0.3.3)
|
5
|
+
activerecord (>= 3.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (4.2.1.rc4)
|
11
|
+
activesupport (= 4.2.1.rc4)
|
12
|
+
builder (~> 3.1)
|
13
|
+
activerecord (4.2.1.rc4)
|
14
|
+
activemodel (= 4.2.1.rc4)
|
15
|
+
activesupport (= 4.2.1.rc4)
|
16
|
+
arel (~> 6.0)
|
17
|
+
activesupport (4.2.1.rc4)
|
18
|
+
i18n (~> 0.7)
|
19
|
+
json (~> 1.7, >= 1.7.7)
|
20
|
+
minitest (~> 5.1)
|
21
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
22
|
+
tzinfo (~> 1.1)
|
23
|
+
arel (6.0.0)
|
24
|
+
builder (3.2.2)
|
25
|
+
diff-lcs (1.2.5)
|
26
|
+
i18n (0.7.0)
|
27
|
+
json (1.8.2)
|
28
|
+
minitest (5.5.1)
|
29
|
+
rspec (2.14.1)
|
30
|
+
rspec-core (~> 2.14.0)
|
31
|
+
rspec-expectations (~> 2.14.0)
|
32
|
+
rspec-mocks (~> 2.14.0)
|
33
|
+
rspec-core (2.14.8)
|
34
|
+
rspec-expectations (2.14.5)
|
35
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
36
|
+
rspec-mocks (2.14.6)
|
37
|
+
sqlite3 (1.3.10)
|
38
|
+
thread_safe (0.3.5)
|
39
|
+
tzinfo (1.2.2)
|
40
|
+
thread_safe (~> 0.1)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
ruby
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
active_type!
|
47
|
+
activerecord (~> 4.2.1.rc4)
|
48
|
+
rspec (< 2.99)
|
49
|
+
sqlite3
|
data/lib/active_type/version.rb
CHANGED
@@ -117,6 +117,15 @@ module ActiveType
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
+
# ActiveRecord 4.2.1
|
121
|
+
def _read_attribute(name)
|
122
|
+
if self.singleton_class._has_virtual_column?(name)
|
123
|
+
read_virtual_attribute(name)
|
124
|
+
else
|
125
|
+
super
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
120
129
|
def []=(name, value)
|
121
130
|
if self.singleton_class._has_virtual_column?(name)
|
122
131
|
write_virtual_attribute(name, value)
|
@@ -17,6 +17,7 @@ module ObjectSpec
|
|
17
17
|
class ObjectWithValidations < Object
|
18
18
|
|
19
19
|
validates :virtual_string, :presence => true
|
20
|
+
validates :virtual_boolean, :presence => true
|
20
21
|
|
21
22
|
end
|
22
23
|
|
@@ -282,10 +283,21 @@ describe ActiveType::Object do
|
|
282
283
|
subject { ObjectSpec::ObjectWithValidations.new }
|
283
284
|
|
284
285
|
it { should have(1).error_on(:virtual_string) }
|
286
|
+
|
287
|
+
it 'validates the presence of boolean values' do
|
288
|
+
subject.virtual_boolean = false
|
289
|
+
subject.should have(1).error_on(:virtual_boolean)
|
290
|
+
subject.virtual_boolean = '0'
|
291
|
+
subject.should have(1).error_on(:virtual_boolean)
|
292
|
+
subject.virtual_boolean = 0
|
293
|
+
subject.should have(1).error_on(:virtual_boolean)
|
294
|
+
subject.virtual_boolean = true
|
295
|
+
subject.should have(0).errors_on(:virtual_boolean)
|
296
|
+
end
|
285
297
|
|
286
298
|
it 'has no errors if validations pass' do
|
287
299
|
subject.virtual_string = "foo"
|
288
|
-
|
300
|
+
subject.virtual_boolean = true
|
289
301
|
subject.should be_valid
|
290
302
|
subject.should have(:no).errors_on(:virtual_string)
|
291
303
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_type
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Kraze
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -73,6 +73,8 @@ files:
|
|
73
73
|
- gemfiles/Gemfile.4.1
|
74
74
|
- gemfiles/Gemfile.4.1.lock
|
75
75
|
- gemfiles/Gemfile.4.2
|
76
|
+
- gemfiles/Gemfile.4.2.1
|
77
|
+
- gemfiles/Gemfile.4.2.1.lock
|
76
78
|
- gemfiles/Gemfile.4.2.lock
|
77
79
|
- gemfiles/Gemfile.4.2.pg
|
78
80
|
- gemfiles/Gemfile.4.2.pg.lock
|