active_type 0.6.0 → 0.6.1
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/README.md +21 -0
- data/active_type.gemspec +1 -1
- data/gemfiles/Gemfile.3.2.mysql2.lock +1 -1
- data/gemfiles/Gemfile.3.2.sqlite3.lock +1 -1
- data/gemfiles/Gemfile.4.0.sqlite3.lock +1 -1
- data/gemfiles/Gemfile.4.1.sqlite3.lock +1 -1
- data/gemfiles/Gemfile.4.2.1.mysql2.lock +1 -1
- data/gemfiles/Gemfile.4.2.1.pg.lock +1 -1
- data/gemfiles/Gemfile.4.2.1.sqlite3.lock +1 -1
- data/gemfiles/Gemfile.5.0.0.mysql2.lock +1 -1
- data/gemfiles/Gemfile.5.0.0.pg.lock +1 -1
- data/gemfiles/Gemfile.5.0.0.sqlite3.lock +1 -1
- data/lib/active_type/version.rb +1 -1
- metadata +3 -53
- data/spec/active_type/extended_record/single_table_inheritance_spec.rb +0 -62
- data/spec/active_type/extended_record_spec.rb +0 -233
- data/spec/active_type/nested_attributes_spec.rb +0 -704
- data/spec/active_type/object_spec.rb +0 -463
- data/spec/active_type/record_spec.rb +0 -274
- data/spec/active_type/util_spec.rb +0 -142
- data/spec/integration/holidays_spec.rb +0 -102
- data/spec/integration/shape_spec.rb +0 -110
- data/spec/integration/sign_in_spec.rb +0 -101
- data/spec/integration/sign_up_spec.rb +0 -102
- data/spec/shared_examples/accessors.rb +0 -24
- data/spec/shared_examples/belongs_to.rb +0 -17
- data/spec/shared_examples/coercible_columns.rb +0 -248
- data/spec/shared_examples/constructor.rb +0 -30
- data/spec/shared_examples/defaults.rb +0 -60
- data/spec/shared_examples/dirty_tracking.rb +0 -40
- data/spec/shared_examples/dupable.rb +0 -31
- data/spec/shared_examples/mass_assignment.rb +0 -26
- data/spec/spec_helper.rb +0 -28
- data/spec/support/database.rb +0 -53
- data/spec/support/database.sample.yml +0 -3
- data/spec/support/error_on.rb +0 -12
- data/spec/support/i18n.rb +0 -1
- data/spec/support/protected_params.rb +0 -20
- data/spec/support/time_zone.rb +0 -1
data/spec/spec_helper.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
$: << File.join(File.dirname(__FILE__), "/../../lib" )
|
4
|
-
|
5
|
-
require 'active_type'
|
6
|
-
|
7
|
-
ActiveRecord::Base.default_timezone = :local
|
8
|
-
ActiveRecord::Base.raise_in_transactional_callbacks = true if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks)
|
9
|
-
|
10
|
-
Dir["#{File.dirname(__FILE__)}/support/*.rb"].each {|f| require f}
|
11
|
-
Dir["#{File.dirname(__FILE__)}/shared_examples/*.rb"].each {|f| require f}
|
12
|
-
|
13
|
-
|
14
|
-
RSpec.configure do |config|
|
15
|
-
config.around do |example|
|
16
|
-
if example.metadata.fetch(:rollback, true)
|
17
|
-
ActiveRecord::Base.transaction do
|
18
|
-
begin
|
19
|
-
example.run
|
20
|
-
ensure
|
21
|
-
raise ActiveRecord::Rollback
|
22
|
-
end
|
23
|
-
end
|
24
|
-
else
|
25
|
-
example.run
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/spec/support/database.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
# pg?
|
4
|
-
case ENV['BUNDLE_GEMFILE']
|
5
|
-
when /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
|
-
# 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)
|
18
|
-
end
|
19
|
-
ActiveRecord::Base.establish_connection(config)
|
20
|
-
else
|
21
|
-
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
connection = ::ActiveRecord::Base.connection
|
26
|
-
connection.tables.each do |table|
|
27
|
-
connection.drop_table table
|
28
|
-
end
|
29
|
-
|
30
|
-
ActiveRecord::Migration.class_eval do
|
31
|
-
|
32
|
-
create_table :records do |t|
|
33
|
-
t.string :persisted_string
|
34
|
-
t.integer :persisted_integer
|
35
|
-
t.datetime :persisted_time
|
36
|
-
t.date :persisted_date
|
37
|
-
t.boolean :persisted_boolean
|
38
|
-
end
|
39
|
-
|
40
|
-
create_table :children do |t|
|
41
|
-
t.integer :record_id
|
42
|
-
end
|
43
|
-
|
44
|
-
create_table :sti_records do |t|
|
45
|
-
t.string :persisted_string
|
46
|
-
t.string :type
|
47
|
-
end
|
48
|
-
|
49
|
-
create_table :other_records do |t|
|
50
|
-
t.string :other_string
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
data/spec/support/error_on.rb
DELETED
data/spec/support/i18n.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
I18n.enforce_available_locales = false
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class ProtectedParams < ActiveSupport::HashWithIndifferentAccess
|
2
|
-
attr_accessor :permitted
|
3
|
-
alias :permitted? :permitted
|
4
|
-
|
5
|
-
def initialize(attributes)
|
6
|
-
super(attributes)
|
7
|
-
@permitted = false
|
8
|
-
end
|
9
|
-
|
10
|
-
def permit!
|
11
|
-
@permitted = true
|
12
|
-
self
|
13
|
-
end
|
14
|
-
|
15
|
-
def dup
|
16
|
-
super.tap do |duplicate|
|
17
|
-
duplicate.instance_variable_set :@permitted, @permitted
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/spec/support/time_zone.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'active_support/time'
|