active_type 0.4.2 → 0.4.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: 68b30f74cacafd71c8c3cdeb7a16f0819bbe5826
4
- data.tar.gz: 347ebc899df117c5265c505aec13bb6f77a4f82b
3
+ metadata.gz: 246492245829189c234439a8edd6332010b65cb1
4
+ data.tar.gz: 8f1067dcb972089bbee267c147b17782513795f3
5
5
  SHA512:
6
- metadata.gz: c13099db232d67a515d3a2a417d2bf3a95549ca69a9772a27e128fef1dffaa20caae45990b16a16ee3745482c11f7b58a737075ba97284057ea6b476fbdbb4ae
7
- data.tar.gz: 23b0da781115e740380532c8092abb3bb74d175e99b56b7d46cdb9fec82e4161568794d95505ce4582822935c1d38d5c5f9a562b25b8ca97258aee7ede110009
6
+ metadata.gz: 30e1c1b46bbb13e3ea56700c001e756d6f7321ab9148f7aec98875114a49549cefe9bb03a888b3ed137632698aa15c933ddfc690abef9b0e67e36fddfd0ba928
7
+ data.tar.gz: 6e507ab9b563b8830a031f090cc05a8e1b5b3c4202ed7ce8029eaf61f4fddc183e21414267f6ae3c6fc46e1f58252273ce9396e710a33b2d8317183567fba5a5
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ tags
4
4
  *.gem
5
5
  .idea
6
6
  tmp
7
+ spec/support/database.yml
data/.travis.yml CHANGED
@@ -6,13 +6,16 @@ rvm:
6
6
  - "2.1.2"
7
7
  - "2.2.0"
8
8
  gemfile:
9
- - gemfiles/Gemfile.3.2
10
- - gemfiles/Gemfile.4.0
11
- - gemfiles/Gemfile.4.1
12
- - gemfiles/Gemfile.4.2.1
9
+ - gemfiles/Gemfile.3.2.mysql2
10
+ - gemfiles/Gemfile.3.2.sqlite3
11
+ - gemfiles/Gemfile.4.0.sqlite3
12
+ - gemfiles/Gemfile.4.1.sqlite3
13
+ - gemfiles/Gemfile.4.2.1.mysql2
13
14
  - gemfiles/Gemfile.4.2.1.pg
15
+ - gemfiles/Gemfile.4.2.1.sqlite3
14
16
  before_script:
15
17
  - psql -c 'create database active_type_test;' -U postgres
18
+ - mysql -e 'create database IF NOT EXISTS active_type_test;'
16
19
  script: bundle exec rspec spec
17
20
  notifications:
18
21
  email:
@@ -23,24 +26,28 @@ branches:
23
26
  matrix:
24
27
  exclude:
25
28
  - rvm: "1.8.7"
26
- gemfile: gemfiles/Gemfile.4.0
29
+ gemfile: gemfiles/Gemfile.4.0.sqlite3
27
30
  - rvm: "1.8.7"
28
- gemfile: gemfiles/Gemfile.4.1
31
+ gemfile: gemfiles/Gemfile.4.1.sqlite3
29
32
  - rvm: "1.8.7"
30
- gemfile: gemfiles/Gemfile.4.2.1
33
+ gemfile: gemfiles/Gemfile.4.2.1.sqlite3
34
+ - rvm: "1.8.7"
35
+ gemfile: gemfiles/Gemfile.4.2.1.mysql2
31
36
  - rvm: "1.8.7"
32
37
  gemfile: gemfiles/Gemfile.4.2.1.pg
38
+ - rvm: "1.9.3"
39
+ gemfile: gemfiles/Gemfile.4.2.1.mysql2
33
40
  - rvm: "1.9.3"
34
41
  gemfile: gemfiles/Gemfile.4.2.1.pg
42
+ - rvm: "2.0.0"
43
+ gemfile: gemfiles/Gemfile.4.2.1.mysql2
35
44
  - rvm: "2.0.0"
36
45
  gemfile: gemfiles/Gemfile.4.2.1.pg
37
-
38
46
  - rvm: "2.1.2"
39
- gemfile: gemfiles/Gemfile.3.2
40
- - rvm: "2.1.2"
41
- gemfile: gemfiles/Gemfile.4.0
42
-
47
+ gemfile: gemfiles/Gemfile.4.0.sqlite3
48
+ - rvm: "2.2.0"
49
+ gemfile: gemfiles/Gemfile.3.2.sqlite3
43
50
  - rvm: "2.2.0"
44
- gemfile: gemfiles/Gemfile.3.2
51
+ gemfile: gemfiles/Gemfile.3.2.mysql2
45
52
  - rvm: "2.2.0"
46
- gemfile: gemfiles/Gemfile.4.0
53
+ gemfile: gemfiles/Gemfile.4.0.sqlite3
data/README.md CHANGED
@@ -193,7 +193,7 @@ end
193
193
 
194
194
  - You have to say `nests_many :records`
195
195
  - `records` will be validated and saved automatically
196
- - The generated `.records_attributes =` expects parameters like `ActiveRecord`'s nested attributes, and words together with the `fields_for` helper:
196
+ - The generated `.records_attributes =` expects parameters like `ActiveRecord`'s nested attributes, and works together with the `fields_for` helper:
197
197
 
198
198
  - either as a hash (where the keys are meaningless)
199
199
 
@@ -335,6 +335,9 @@ Development
335
335
  - You can run specs against all versions with `rake all:spec`.
336
336
  - You can run specs against a single version with `VERSION=4.0 rake`.
337
337
 
338
+ If you are getting testing failures due to Mysql trying to connect as `root` user, you can put your Mysql credentials into `spec/support/database.yml`.
339
+ See `spec/support/database.sample.yml` for an example.
340
+
338
341
  If you would like to contribute:
339
342
 
340
343
  - Fork the repository.
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '=3.2.22'
4
+ gem 'rspec', '<2.99'
5
+ gem 'mysql2', '= 0.3.11'
6
+
7
+ gem 'active_type', :path => '..'
8
+ gem 'i18n', '=0.6.11' # 0.7 no longer builds for Ruby 1.8.7
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_type (0.4.2)
5
+ activerecord (>= 3.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (3.2.22)
11
+ activesupport (= 3.2.22)
12
+ builder (~> 3.0.0)
13
+ activerecord (3.2.22)
14
+ activemodel (= 3.2.22)
15
+ activesupport (= 3.2.22)
16
+ arel (~> 3.0.2)
17
+ tzinfo (~> 0.3.29)
18
+ activesupport (3.2.22)
19
+ i18n (~> 0.6, >= 0.6.4)
20
+ multi_json (~> 1.0)
21
+ arel (3.0.3)
22
+ builder (3.0.4)
23
+ diff-lcs (1.2.5)
24
+ i18n (0.6.11)
25
+ multi_json (1.11.2)
26
+ mysql2 (0.3.11)
27
+ rspec (2.14.1)
28
+ rspec-core (~> 2.14.0)
29
+ rspec-expectations (~> 2.14.0)
30
+ rspec-mocks (~> 2.14.0)
31
+ rspec-core (2.14.8)
32
+ rspec-expectations (2.14.5)
33
+ diff-lcs (>= 1.1.3, < 2.0)
34
+ rspec-mocks (2.14.6)
35
+ tzinfo (0.3.45)
36
+
37
+ PLATFORMS
38
+ ruby
39
+
40
+ DEPENDENCIES
41
+ active_type!
42
+ activerecord (= 3.2.22)
43
+ i18n (= 0.6.11)
44
+ mysql2 (= 0.3.11)
45
+ rspec (< 2.99)
46
+
47
+ BUNDLED WITH
48
+ 1.10.6
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'activerecord', '~>3.2.0'
3
+ gem 'activerecord', '=3.2.22'
4
4
  gem 'rspec', '<2.99'
5
5
  gem 'sqlite3'
6
6
 
@@ -7,15 +7,15 @@ PATH
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.21)
11
- activesupport (= 3.2.21)
10
+ activemodel (3.2.22)
11
+ activesupport (= 3.2.22)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.21)
14
- activemodel (= 3.2.21)
15
- activesupport (= 3.2.21)
13
+ activerecord (3.2.22)
14
+ activemodel (= 3.2.22)
15
+ activesupport (= 3.2.22)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.21)
18
+ activesupport (3.2.22)
19
19
  i18n (~> 0.6, >= 0.6.4)
20
20
  multi_json (~> 1.0)
21
21
  arel (3.0.3)
@@ -39,7 +39,10 @@ PLATFORMS
39
39
 
40
40
  DEPENDENCIES
41
41
  active_type!
42
- activerecord (~> 3.2.0)
42
+ activerecord (= 3.2.22)
43
43
  i18n (= 0.6.11)
44
44
  rspec (< 2.99)
45
45
  sqlite3
46
+
47
+ BUNDLED WITH
48
+ 1.10.6
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '~>4.2.1'
4
+ gem 'rspec', '<2.99'
5
+ gem 'mysql2', '~> 0.3.17'
6
+
7
+ gem 'active_type', :path => '..'
@@ -0,0 +1,52 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_type (0.4.2)
5
+ activerecord (>= 3.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (4.2.1)
11
+ activesupport (= 4.2.1)
12
+ builder (~> 3.1)
13
+ activerecord (4.2.1)
14
+ activemodel (= 4.2.1)
15
+ activesupport (= 4.2.1)
16
+ arel (~> 6.0)
17
+ activesupport (4.2.1)
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.3)
28
+ minitest (5.7.0)
29
+ mysql2 (0.3.20)
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.5)
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.1)
48
+ mysql2 (~> 0.3.17)
49
+ rspec (< 2.99)
50
+
51
+ BUNDLED WITH
52
+ 1.10.6
File without changes
@@ -68,8 +68,8 @@ module ActiveType
68
68
  # The specified type (e.g. "string") may not necessary match the
69
69
  # native type ("varchar") expected by the connection adapter.
70
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)
71
+ # supports it (but don't turn a mysql boolean into a tinyint).
72
+ if !type.nil? && !(type == :boolean) && connection.respond_to?(:native_database_types)
73
73
  native_type = connection.native_database_types[type.to_sym]
74
74
  if native_type && native_type[:name]
75
75
  type = native_type[:name]
@@ -1,3 +1,3 @@
1
1
  module ActiveType
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -6,8 +6,8 @@ require 'active_type'
6
6
 
7
7
  ActiveRecord::Base.default_timezone = :local
8
8
 
9
- Dir["#{File.dirname(__FILE__)}/support/*"].each {|f| require f}
10
- Dir["#{File.dirname(__FILE__)}/shared_examples/*"].each {|f| require f}
9
+ Dir["#{File.dirname(__FILE__)}/support/*.rb"].each {|f| require f}
10
+ Dir["#{File.dirname(__FILE__)}/shared_examples/*.rb"].each {|f| require f}
11
11
 
12
12
 
13
13
  RSpec.configure do |config|
@@ -1,18 +1,32 @@
1
- begin
2
- # sqlite?
3
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
4
- rescue Gem::LoadError
5
- # pg?
1
+ require 'yaml'
2
+
3
+ # pg?
4
+ case ENV['BUNDLE_GEMFILE']
5
+ when /pg/
6
6
  if ENV['TRAVIS']
7
7
  ActiveRecord::Base.establish_connection(:adapter => 'postgresql', :database => 'active_type_test', :username => 'postgres')
8
8
  else
9
9
  ActiveRecord::Base.establish_connection(:adapter => 'postgresql', :database => 'active_type_test')
10
10
  end
11
-
12
- connection = ::ActiveRecord::Base.connection
13
- connection.tables.each do |table|
14
- connection.drop_table table
11
+ # mysql2?
12
+ when /mysql2/
13
+ config = { :adapter => 'mysql2', :encoding => 'utf8', :database => 'active_type_test' }
14
+ custom_config_path = File.join(File.dirname(__FILE__), 'database.yml')
15
+ if File.exists?(custom_config_path)
16
+ custom_config = YAML.load_file(custom_config_path)
17
+ config.merge!(custom_config)
15
18
  end
19
+ ActiveRecord::Base.establish_connection(config)
20
+ when /sqlite3/
21
+ ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
22
+ else
23
+ raise "Unknown database type in Gemfile suffix: #{ENV['BUNDLE_GEMFILE']}"
24
+ end
25
+
26
+
27
+ connection = ::ActiveRecord::Base.connection
28
+ connection.tables.each do |table|
29
+ connection.drop_table table
16
30
  end
17
31
 
18
32
  ActiveRecord::Migration.class_eval do
@@ -0,0 +1,3 @@
1
+ host: localhost
2
+ username: joe
3
+ password: secret
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.4.2
4
+ version: 0.4.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-09-24 00:00:00.000000000 Z
12
+ date: 2015-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -67,16 +67,20 @@ files:
67
67
  - README.md
68
68
  - Rakefile
69
69
  - active_type.gemspec
70
- - gemfiles/Gemfile.3.2
71
- - gemfiles/Gemfile.3.2.lock
72
- - gemfiles/Gemfile.4.0
73
- - gemfiles/Gemfile.4.0.lock
74
- - gemfiles/Gemfile.4.1
75
- - gemfiles/Gemfile.4.1.lock
76
- - gemfiles/Gemfile.4.2.1
77
- - gemfiles/Gemfile.4.2.1.lock
70
+ - gemfiles/Gemfile.3.2.mysql2
71
+ - gemfiles/Gemfile.3.2.mysql2.lock
72
+ - gemfiles/Gemfile.3.2.sqlite3
73
+ - gemfiles/Gemfile.3.2.sqlite3.lock
74
+ - gemfiles/Gemfile.4.0.sqlite3
75
+ - gemfiles/Gemfile.4.0.sqlite3.lock
76
+ - gemfiles/Gemfile.4.1.sqlite3
77
+ - gemfiles/Gemfile.4.1.sqlite3.lock
78
+ - gemfiles/Gemfile.4.2.1.mysql2
79
+ - gemfiles/Gemfile.4.2.1.mysql2.lock
78
80
  - gemfiles/Gemfile.4.2.1.pg
79
81
  - gemfiles/Gemfile.4.2.1.pg.lock
82
+ - gemfiles/Gemfile.4.2.1.sqlite3
83
+ - gemfiles/Gemfile.4.2.1.sqlite3.lock
80
84
  - lib/active_type.rb
81
85
  - lib/active_type/extended_record.rb
82
86
  - lib/active_type/extended_record/inheritance.rb
@@ -112,6 +116,7 @@ files:
112
116
  - spec/shared_examples/mass_assignment.rb
113
117
  - spec/spec_helper.rb
114
118
  - spec/support/database.rb
119
+ - spec/support/database.sample.yml
115
120
  - spec/support/error_on.rb
116
121
  - spec/support/i18n.rb
117
122
  - spec/support/protected_params.rb
@@ -161,6 +166,7 @@ test_files:
161
166
  - spec/shared_examples/mass_assignment.rb
162
167
  - spec/spec_helper.rb
163
168
  - spec/support/database.rb
169
+ - spec/support/database.sample.yml
164
170
  - spec/support/error_on.rb
165
171
  - spec/support/i18n.rb
166
172
  - spec/support/protected_params.rb