activerecord_hstore_boolean 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 695aa75ecb9fb867282d35ad09324488055e62bc
|
4
|
+
data.tar.gz: 2135a5bfef48e7f2d38159a49dd14190dbbd13be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb05cf19d2acbf71f1e64c4eec241acd22473c0bc03828f0cb39239f6ff9eda57450e1f90cd618235ae8ea91b6e55b6757fc3c190d318e5f416cbd778b07407f
|
7
|
+
data.tar.gz: 06731375893c2106a4d55b15ec5699a73386ed78ca6f2c3f795661984efa33f3c2c717c8985c8de35479eb06fabd881d1e62df139babd7da59b52d521169ea9f
|
@@ -20,7 +20,7 @@ module ActiverecordHstoreBoolean
|
|
20
20
|
|
21
21
|
define_method(attr_name) do
|
22
22
|
self[attr_name].each do |key, value|
|
23
|
-
self[attr_name][key] = value
|
23
|
+
self[attr_name][key] = [STORED_TRUE_VALUE, true].include?(value) if keys.include?(key.to_s)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -12,7 +12,6 @@ describe ActiverecordHstoreBoolean do
|
|
12
12
|
expect(product.properties['popular']).to be_true
|
13
13
|
expect(product.properties['color']).to eq 'white'
|
14
14
|
end
|
15
|
-
|
16
15
|
end
|
17
16
|
|
18
17
|
it 'normalize falue value' do
|
@@ -21,4 +20,13 @@ describe ActiverecordHstoreBoolean do
|
|
21
20
|
expect(product.properties['popular']).to be_false
|
22
21
|
expect(product.properties['color']).to eq 'white'
|
23
22
|
end
|
23
|
+
|
24
|
+
context 'get value twice' do
|
25
|
+
it do
|
26
|
+
product = Product.create(properties: { popular: true, color: 'white' })
|
27
|
+
product.reload
|
28
|
+
product.properties['popular']
|
29
|
+
expect(product.properties['popular']).to be_true
|
30
|
+
end
|
31
|
+
end
|
24
32
|
end
|