statham 0.1.8 → 0.1.9
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/lib/statham/attribute.rb +2 -0
- data/lib/statham/version.rb +1 -1
- data/spec/unit/attribute_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aef8aa709c796632d5b92994731e8c7092348677
|
4
|
+
data.tar.gz: e28d72d717b65d853741dfae79d20d01ed6de219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef75a534a2ffbdda01cdd045e23ad21148698270ac7213b7fbbd846f6533086902478737249128bc966ca8cd11bf6b6f8bf4e74a452b91b0f2b9ddd34ac23293
|
7
|
+
data.tar.gz: 57d4cd682c96c8434952f846a0d8924c7aef8e54bf984d08ea59cc36f93c3c6b9151ba5c28e983036489b1895f7e140370009d8ee671cf5e4c126268b0b0dc41
|
data/lib/statham/attribute.rb
CHANGED
data/lib/statham/version.rb
CHANGED
data/spec/unit/attribute_spec.rb
CHANGED
@@ -31,6 +31,19 @@ describe Statham::Attribute do
|
|
31
31
|
it { expect { attribute.serialize([1, 2, 3]) }.to raise_error }
|
32
32
|
end
|
33
33
|
|
34
|
+
context 'when type is float' do
|
35
|
+
let(:attribute) { Statham::Attribute.new(type: :float) }
|
36
|
+
|
37
|
+
it { expect(attribute.serialize(nil)).to be_nil }
|
38
|
+
it { expect { attribute.serialize(true) }.to raise_error }
|
39
|
+
it { expect { attribute.serialize({ foo: :bar }) }.to raise_error }
|
40
|
+
it { expect { attribute.serialize('string') }.not_to raise_error }
|
41
|
+
it { expect(attribute.serialize('string')).to eq(0) }
|
42
|
+
it { expect { attribute.serialize([1, 2, 3]) }.to raise_error }
|
43
|
+
it { expect { attribute.serialize(1) }.not_to raise_error }
|
44
|
+
it { expect(attribute.serialize(1)).to eq(1.to_f) }
|
45
|
+
end
|
46
|
+
|
34
47
|
context 'when default value is set' do
|
35
48
|
let(:default) { 'hello' }
|
36
49
|
let(:value) { 'world' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statham
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Inbeom Hwang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|