active_type 0.3.2 → 0.3.3

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: a2d3c1730d1b0d1175a5ef12eba8ec4f4d39ebbf
4
- data.tar.gz: 0bec41f0aaf446a3e96cd006181848e61e293abe
3
+ metadata.gz: f3cef4ee7f980941d6ce98ea722f3be8d926147d
4
+ data.tar.gz: 789c82e02dc5689747cb2e0d9ee78f390f00e4de
5
5
  SHA512:
6
- metadata.gz: 05954c59d026aa8b6ec4e4d300287e467fddd527ed788cf0cade8b9da45b6a46f6997990b61b94a2a030c79517057252fa5074af3c6ff9191f97647f95b0db0c
7
- data.tar.gz: e966f0029d64e54bf391866d6485abd5f783b9b810b7340207c609c0db66ca558136c84af92db8b236761b7bf069c53cea45209c6136fc830816309a700696ce
6
+ metadata.gz: cfe7272f70e29e0ee3ec6ab1e085ee1dd2ae77539911417a58505ea29f8b4609d185d4d37ccf50e287d10e5196ff7a9885493601327457a939317e48d8440086
7
+ data.tar.gz: f6b631538c8fee8e0d0636ad532e13f6ce9ca2b9c2c624e042ea64f9b86eaef27f835cb291458ca806641f8d3b01405fddd35ae8f0197274838d3d463947ca8f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.3.2)
4
+ active_type (0.3.3)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.3.2)
4
+ active_type (0.3.3)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.3.2)
4
+ active_type (0.3.3)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.3.2)
4
+ active_type (0.3.3)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.3.2)
4
+ active_type (0.3.3)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
@@ -71,7 +71,12 @@ module ActiveType
71
71
  # supports it.
72
72
  if !type.nil? && connection.respond_to?(:native_database_types)
73
73
  native_type = connection.native_database_types[type.to_sym]
74
- type = native_type.fetch(:name) unless native_type.nil?
74
+ if native_type && native_type[:name]
75
+ type = native_type[:name]
76
+ else
77
+ # unknown type, we just dont cast
78
+ type = nil
79
+ end
75
80
  end
76
81
  @active_record_type = connection.lookup_cast_type(type)
77
82
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveType
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
@@ -79,6 +79,10 @@ module ObjectSpec
79
79
 
80
80
  end
81
81
 
82
+ class ObjectWithUnsupportedTypes < Object
83
+ attribute :virtual_array, :array
84
+ attribute :virtual_hash, :hash
85
+ end
82
86
 
83
87
  end
84
88
 
@@ -102,6 +106,13 @@ describe ActiveType::Object do
102
106
  it_should_behave_like 'ActiveRecord-like accessors', { :virtual_string => "string", :virtual_integer => 100, :virtual_time => Time.now, :virtual_date => Date.today, :virtual_boolean => true }
103
107
  end
104
108
 
109
+ describe 'unsupported types' do
110
+ subject { ObjectSpec::ObjectWithUnsupportedTypes.new }
111
+
112
+ it_should_behave_like 'ActiveRecord-like mass assignment', { :virtual_hash => {'foo' => 'bar'}, :virtual_array => ['foo', 'bar'] }
113
+ it_should_behave_like 'ActiveRecord-like accessors', { :virtual_hash => {'foo' => 'bar'}, :virtual_array => ['foo', 'bar'] }
114
+ end
115
+
105
116
  describe 'overridable attributes' do
106
117
  subject { ObjectSpec::ObjectWithOverrides.new }
107
118
 
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.2
4
+ version: 0.3.3
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-01-22 00:00:00.000000000 Z
12
+ date: 2015-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler