active_type 0.3.1 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d34e93d8bb376b7afcf631c41e4656b34346488e
4
- data.tar.gz: 4cfe64618490965f0c4bc1a4dcf6771aca4e6ed8
3
+ metadata.gz: a2d3c1730d1b0d1175a5ef12eba8ec4f4d39ebbf
4
+ data.tar.gz: 0bec41f0aaf446a3e96cd006181848e61e293abe
5
5
  SHA512:
6
- metadata.gz: 85a874cbe804ed0b878d03f085bbaf81a48de22ee94425d4dbc7e01d0d118bbd6affd9f9f39ab4108eb1f25ab980f043e4f7eb0ba348b248b5abc567a5d0c3ea
7
- data.tar.gz: b43cc5c7ae0382efc4c9c4de62c68d10078f486d8596f7fc2709ff5eb938536f18a8f4519c7a884028d49ad9671866e6668389ddc71c3c277f8ea30e10b76ded
6
+ metadata.gz: 05954c59d026aa8b6ec4e4d300287e467fddd527ed788cf0cade8b9da45b6a46f6997990b61b94a2a030c79517057252fa5074af3c6ff9191f97647f95b0db0c
7
+ data.tar.gz: e966f0029d64e54bf391866d6485abd5f783b9b810b7340207c609c0db66ca558136c84af92db8b236761b7bf069c53cea45209c6136fc830816309a700696ce
data/.travis.yml CHANGED
@@ -4,10 +4,15 @@ rvm:
4
4
  - "1.9.3"
5
5
  - "2.0.0"
6
6
  - "2.1.2"
7
+ - "2.2.0"
7
8
  gemfile:
8
9
  - gemfiles/Gemfile.3.2
9
10
  - gemfiles/Gemfile.4.0
10
11
  - gemfiles/Gemfile.4.1
12
+ - gemfiles/Gemfile.4.2
13
+ - gemfiles/Gemfile.4.2.pg
14
+ before_script:
15
+ - psql -c 'create database active_type_test;' -U postgres
11
16
  script: bundle exec rspec spec
12
17
  notifications:
13
18
  email:
@@ -21,3 +26,19 @@ matrix:
21
26
  gemfile: gemfiles/Gemfile.4.0
22
27
  - rvm: "1.8.7"
23
28
  gemfile: gemfiles/Gemfile.4.1
29
+ - rvm: "1.8.7"
30
+ gemfile: gemfiles/Gemfile.4.2
31
+ - rvm: "1.8.7"
32
+ gemfile: gemfiles/Gemfile.4.2.pg
33
+ - rvm: "1.9.3"
34
+ gemfile: gemfiles/Gemfile.4.2.pg
35
+ - rvm: "2.0.0"
36
+ gemfile: gemfiles/Gemfile.4.2.pg
37
+ - rvm: "2.1.2"
38
+ gemfile: gemfiles/Gemfile.3.2
39
+ - rvm: "2.1.2"
40
+ gemfile: gemfiles/Gemfile.4.0
41
+ - rvm: "2.2.0"
42
+ gemfile: gemfiles/Gemfile.3.2
43
+ - rvm: "2.2.0"
44
+ gemfile: gemfiles/Gemfile.4.0
data/README.md CHANGED
@@ -274,7 +274,7 @@ Supported options for `nests_many` / `nests_one` are:
274
274
  Supported Rails versions
275
275
  ------------------------
276
276
 
277
- ActiveType is tested against ActiveRecord 3.2, 4.0, 4.1 and 4.2beta.
277
+ ActiveType is tested against ActiveRecord 3.2, 4.0, 4.1 and 4.2.
278
278
 
279
279
  Later versions might work, earlier will not.
280
280
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.3.1)
4
+ active_type (0.3.2)
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.1)
4
+ active_type (0.3.2)
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.1)
4
+ active_type (0.3.2)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
data/gemfiles/Gemfile.4.2 CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'activerecord', '~>4.2.0.beta1'
3
+ gem 'activerecord', '~>4.2.0'
4
4
  gem 'rspec', '<2.99'
5
5
  gem 'sqlite3'
6
6
 
@@ -1,31 +1,31 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_type (0.3.1)
4
+ active_type (0.3.2)
5
5
  activerecord (>= 3.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (4.2.0.beta1)
11
- activesupport (= 4.2.0.beta1)
10
+ activemodel (4.2.0)
11
+ activesupport (= 4.2.0)
12
12
  builder (~> 3.1)
13
- activerecord (4.2.0.beta1)
14
- activemodel (= 4.2.0.beta1)
15
- activesupport (= 4.2.0.beta1)
16
- arel (>= 6.0.0.beta1, < 6.1)
17
- activesupport (4.2.0.beta1)
18
- i18n (>= 0.7.0.beta1, < 0.8)
13
+ activerecord (4.2.0)
14
+ activemodel (= 4.2.0)
15
+ activesupport (= 4.2.0)
16
+ arel (~> 6.0)
17
+ activesupport (4.2.0)
18
+ i18n (~> 0.7)
19
19
  json (~> 1.7, >= 1.7.7)
20
20
  minitest (~> 5.1)
21
- thread_safe (~> 0.1)
21
+ thread_safe (~> 0.3, >= 0.3.4)
22
22
  tzinfo (~> 1.1)
23
- arel (6.0.0.beta1)
23
+ arel (6.0.0)
24
24
  builder (3.2.2)
25
25
  diff-lcs (1.2.5)
26
- i18n (0.7.0.beta1)
27
- json (1.8.1)
28
- minitest (5.4.1)
26
+ i18n (0.7.0)
27
+ json (1.8.2)
28
+ minitest (5.5.1)
29
29
  rspec (2.14.1)
30
30
  rspec-core (~> 2.14.0)
31
31
  rspec-expectations (~> 2.14.0)
@@ -44,6 +44,6 @@ PLATFORMS
44
44
 
45
45
  DEPENDENCIES
46
46
  active_type!
47
- activerecord (~> 4.2.0.beta1)
47
+ activerecord (~> 4.2.0)
48
48
  rspec (< 2.99)
49
49
  sqlite3
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '~>4.2.0'
4
+ gem 'rspec', '<2.99'
5
+ gem 'pg'
6
+
7
+ gem 'active_type', :path => '..'
@@ -0,0 +1,49 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_type (0.3.2)
5
+ activerecord (>= 3.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (4.2.0)
11
+ activesupport (= 4.2.0)
12
+ builder (~> 3.1)
13
+ activerecord (4.2.0)
14
+ activemodel (= 4.2.0)
15
+ activesupport (= 4.2.0)
16
+ arel (~> 6.0)
17
+ activesupport (4.2.0)
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
+ pg (0.18.1)
30
+ rspec (2.14.1)
31
+ rspec-core (~> 2.14.0)
32
+ rspec-expectations (~> 2.14.0)
33
+ rspec-mocks (~> 2.14.0)
34
+ rspec-core (2.14.8)
35
+ rspec-expectations (2.14.5)
36
+ diff-lcs (>= 1.1.3, < 2.0)
37
+ rspec-mocks (2.14.6)
38
+ thread_safe (0.3.4)
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.0)
48
+ pg
49
+ rspec (< 2.99)
@@ -7,6 +7,14 @@ module ActiveType
7
7
 
8
8
  module ClassMethods
9
9
 
10
+ def primary_key
11
+ nil
12
+ end
13
+
14
+ def column_types
15
+ {}
16
+ end
17
+
10
18
  def columns
11
19
  []
12
20
  end
@@ -65,6 +65,14 @@ module ActiveType
65
65
  class DelegateToType
66
66
 
67
67
  def initialize(type, connection)
68
+ # The specified type (e.g. "string") may not necessary match the
69
+ # native type ("varchar") expected by the connection adapter.
70
+ # PostgreSQL is one of these. Perform a translation if the adapter
71
+ # supports it.
72
+ if !type.nil? && connection.respond_to?(:native_database_types)
73
+ native_type = connection.native_database_types[type.to_sym]
74
+ type = native_type.fetch(:name) unless native_type.nil?
75
+ end
68
76
  @active_record_type = connection.lookup_cast_type(type)
69
77
  end
70
78
 
@@ -1,3 +1,3 @@
1
1
  module ActiveType
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -329,9 +329,14 @@ describe ActiveType::Object do
329
329
 
330
330
  describe '.find' do
331
331
  it 'raises an error' do
332
+ error = if ActiveRecord::VERSION::MAJOR >= 4 && ActiveRecord::VERSION::MINOR >= 1
333
+ ActiveRecord::UnknownPrimaryKey
334
+ else
335
+ ActiveRecord::RecordNotFound
336
+ end
332
337
  expect do
333
338
  ObjectSpec::Object.find(1)
334
- end.to raise_error(ActiveRecord::RecordNotFound)
339
+ end.to raise_error(error)
335
340
  end
336
341
  end
337
342
 
@@ -1,4 +1,19 @@
1
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
1
+ begin
2
+ # sqlite?
3
+ ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
4
+ rescue Gem::LoadError
5
+ # pg?
6
+ if ENV['TRAVIS']
7
+ ActiveRecord::Base.establish_connection(:adapter => 'postgresql', :database => 'active_type_test', :username => 'postgres')
8
+ else
9
+ ActiveRecord::Base.establish_connection(:adapter => 'postgresql', :database => 'active_type_test')
10
+ end
11
+
12
+ connection = ::ActiveRecord::Base.connection
13
+ connection.tables.each do |table|
14
+ connection.drop_table table
15
+ end
16
+ end
2
17
 
3
18
  ActiveRecord::Migration.class_eval do
4
19
 
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.1
4
+ version: 0.3.2
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: 2014-11-19 00:00:00.000000000 Z
12
+ date: 2015-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -74,6 +74,8 @@ files:
74
74
  - gemfiles/Gemfile.4.1.lock
75
75
  - gemfiles/Gemfile.4.2
76
76
  - gemfiles/Gemfile.4.2.lock
77
+ - gemfiles/Gemfile.4.2.pg
78
+ - gemfiles/Gemfile.4.2.pg.lock
77
79
  - lib/active_type.rb
78
80
  - lib/active_type/extended_record.rb
79
81
  - lib/active_type/extended_record/inheritance.rb