statham 0.1.5 → 0.1.6

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: fd967b72b964ecbf39c69833c38424e80bc876c4
4
- data.tar.gz: 4c69fe952d786af7a610fe0353e28ad2b59e0343
3
+ metadata.gz: 2ef2e0599773c326dc2fe71f37e2bc4bba172048
4
+ data.tar.gz: 7c86669164bae3c87918ba48659b63c0737c61c4
5
5
  SHA512:
6
- metadata.gz: 4034b0d3d328b5902bff7eddcbdfd9fd49dc3b5078ad4ccfa3913842a02005da0679756c5746660bab0c615b0accb0ce348c20eea0d71d6a17793e4064f82e37
7
- data.tar.gz: 3c9909c9c011c600543e858c7e7921672699be9fc4997911dc9a14b6c0809423a9ff3fcaa7d15e34d32a71630fec5182bcd4588d11f9a05fa51aad4d4f21fc2f
6
+ metadata.gz: 259d08ef343b95cefda82b7bb388379ecd87b25fa45b85eae03cea87135581f989f6cf5ca7faedda0e4231d0f6972279dbb38c370e20ed43844476098f0688b5
7
+ data.tar.gz: 42b49440d86b7614fd288ab5fcd2c9a867f621e0545a75bdefc63a6e64e7f0c5aaeb9f5f0ac0288b32f93c54e91a800171d3b26ddc2cdfcdcdfac11a09d5997a
@@ -57,6 +57,8 @@ module Statham
57
57
  value.to_i
58
58
  when :array
59
59
  value.to_a
60
+ when :hash
61
+ value.to_h
60
62
  else
61
63
  value.to_s
62
64
  end
@@ -1,3 +1,3 @@
1
1
  module Statham
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
@@ -21,6 +21,16 @@ describe Statham::Attribute do
21
21
  it { expect { attribute.serialize([1, 2, 3]) }.not_to raise_error }
22
22
  end
23
23
 
24
+ context 'when type is hash' do
25
+ let(:attribute) { Statham::Attribute.new(type: :hash) }
26
+
27
+ it { expect(attribute.serialize(nil)).to be_nil }
28
+ it { expect { attribute.serialize(true) }.to raise_error }
29
+ it { expect { attribute.serialize({ foo: :bar }) }.not_to raise_error }
30
+ it { expect { attribute.serialize('string') }.to raise_error }
31
+ it { expect { attribute.serialize([1, 2, 3]) }.to raise_error }
32
+ end
33
+
24
34
  context 'when default value is set' do
25
35
  let(:default) { 'hello' }
26
36
  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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inbeom Hwang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-12 00:00:00.000000000 Z
11
+ date: 2014-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport