active_data 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rspec +0 -1
- data/.rvmrc +1 -1
- data/.travis.yml +13 -6
- data/Appraisals +7 -0
- data/Gemfile +1 -5
- data/Guardfile +68 -15
- data/README.md +144 -2
- data/active_data.gemspec +19 -11
- data/gemfiles/rails.4.0.gemfile +14 -0
- data/gemfiles/rails.4.1.gemfile +14 -0
- data/gemfiles/rails.4.2.gemfile +14 -0
- data/gemfiles/rails.5.0.gemfile +14 -0
- data/lib/active_data.rb +120 -3
- data/lib/active_data/active_record/associations.rb +50 -0
- data/lib/active_data/active_record/nested_attributes.rb +24 -0
- data/lib/active_data/config.rb +40 -0
- data/lib/active_data/errors.rb +93 -0
- data/lib/active_data/extensions.rb +33 -0
- data/lib/active_data/model.rb +16 -74
- data/lib/active_data/model/associations.rb +84 -15
- data/lib/active_data/model/associations/base.rb +79 -0
- data/lib/active_data/model/associations/collection/embedded.rb +12 -0
- data/lib/active_data/model/associations/collection/proxy.rb +32 -0
- data/lib/active_data/model/associations/collection/referenced.rb +26 -0
- data/lib/active_data/model/associations/embeds_many.rb +124 -18
- data/lib/active_data/model/associations/embeds_one.rb +90 -15
- data/lib/active_data/model/associations/nested_attributes.rb +180 -0
- data/lib/active_data/model/associations/references_many.rb +96 -0
- data/lib/active_data/model/associations/references_one.rb +83 -0
- data/lib/active_data/model/associations/reflections/base.rb +100 -0
- data/lib/active_data/model/associations/reflections/embeds_many.rb +25 -0
- data/lib/active_data/model/associations/reflections/embeds_one.rb +49 -0
- data/lib/active_data/model/associations/reflections/reference_reflection.rb +45 -0
- data/lib/active_data/model/associations/reflections/references_many.rb +28 -0
- data/lib/active_data/model/associations/reflections/references_one.rb +28 -0
- data/lib/active_data/model/associations/validations.rb +63 -0
- data/lib/active_data/model/attributes.rb +247 -0
- data/lib/active_data/model/attributes/attribute.rb +73 -0
- data/lib/active_data/model/attributes/base.rb +116 -0
- data/lib/active_data/model/attributes/collection.rb +17 -0
- data/lib/active_data/model/attributes/dictionary.rb +26 -0
- data/lib/active_data/model/attributes/localized.rb +42 -0
- data/lib/active_data/model/attributes/reference_many.rb +21 -0
- data/lib/active_data/model/attributes/reference_one.rb +42 -0
- data/lib/active_data/model/attributes/reflections/attribute.rb +55 -0
- data/lib/active_data/model/attributes/reflections/base.rb +62 -0
- data/lib/active_data/model/attributes/reflections/collection.rb +10 -0
- data/lib/active_data/model/attributes/reflections/dictionary.rb +13 -0
- data/lib/active_data/model/attributes/reflections/localized.rb +43 -0
- data/lib/active_data/model/attributes/reflections/reference_many.rb +10 -0
- data/lib/active_data/model/attributes/reflections/reference_one.rb +58 -0
- data/lib/active_data/model/attributes/reflections/represents.rb +55 -0
- data/lib/active_data/model/attributes/represents.rb +64 -0
- data/lib/active_data/model/callbacks.rb +71 -0
- data/lib/active_data/model/conventions.rb +35 -0
- data/lib/active_data/model/dirty.rb +77 -0
- data/lib/active_data/model/lifecycle.rb +307 -0
- data/lib/active_data/model/localization.rb +21 -0
- data/lib/active_data/model/persistence.rb +57 -0
- data/lib/active_data/model/primary.rb +51 -0
- data/lib/active_data/model/scopes.rb +77 -0
- data/lib/active_data/model/validations.rb +27 -0
- data/lib/active_data/model/validations/associated.rb +19 -0
- data/lib/active_data/model/validations/nested.rb +39 -0
- data/lib/active_data/railtie.rb +7 -0
- data/lib/active_data/version.rb +1 -1
- data/spec/lib/active_data/active_record/associations_spec.rb +149 -0
- data/spec/lib/active_data/active_record/nested_attributes_spec.rb +16 -0
- data/spec/lib/active_data/config_spec.rb +44 -0
- data/spec/lib/active_data/model/associations/embeds_many_spec.rb +362 -52
- data/spec/lib/active_data/model/associations/embeds_one_spec.rb +250 -31
- data/spec/lib/active_data/model/associations/nested_attributes_spec.rb +23 -0
- data/spec/lib/active_data/model/associations/references_many_spec.rb +196 -0
- data/spec/lib/active_data/model/associations/references_one_spec.rb +134 -0
- data/spec/lib/active_data/model/associations/reflections/embeds_many_spec.rb +144 -0
- data/spec/lib/active_data/model/associations/reflections/embeds_one_spec.rb +116 -0
- data/spec/lib/active_data/model/associations/reflections/references_many_spec.rb +255 -0
- data/spec/lib/active_data/model/associations/reflections/references_one_spec.rb +208 -0
- data/spec/lib/active_data/model/associations/validations_spec.rb +153 -0
- data/spec/lib/active_data/model/associations_spec.rb +189 -0
- data/spec/lib/active_data/model/attributes/attribute_spec.rb +144 -0
- data/spec/lib/active_data/model/attributes/base_spec.rb +82 -0
- data/spec/lib/active_data/model/attributes/collection_spec.rb +73 -0
- data/spec/lib/active_data/model/attributes/dictionary_spec.rb +93 -0
- data/spec/lib/active_data/model/attributes/localized_spec.rb +88 -33
- data/spec/lib/active_data/model/attributes/reflections/attribute_spec.rb +72 -0
- data/spec/lib/active_data/model/attributes/reflections/base_spec.rb +56 -0
- data/spec/lib/active_data/model/attributes/reflections/collection_spec.rb +37 -0
- data/spec/lib/active_data/model/attributes/reflections/dictionary_spec.rb +43 -0
- data/spec/lib/active_data/model/attributes/reflections/localized_spec.rb +37 -0
- data/spec/lib/active_data/model/attributes/reflections/represents_spec.rb +70 -0
- data/spec/lib/active_data/model/attributes/represents_spec.rb +153 -0
- data/spec/lib/active_data/model/attributes_spec.rb +243 -0
- data/spec/lib/active_data/model/callbacks_spec.rb +338 -0
- data/spec/lib/active_data/model/conventions_spec.rb +12 -0
- data/spec/lib/active_data/model/dirty_spec.rb +75 -0
- data/spec/lib/active_data/model/lifecycle_spec.rb +330 -0
- data/spec/lib/active_data/model/nested_attributes.rb +202 -0
- data/spec/lib/active_data/model/persistence_spec.rb +47 -0
- data/spec/lib/active_data/model/primary_spec.rb +84 -0
- data/spec/lib/active_data/model/scopes_spec.rb +88 -0
- data/spec/lib/active_data/model/typecasting_spec.rb +192 -0
- data/spec/lib/active_data/model/validations/associated_spec.rb +94 -0
- data/spec/lib/active_data/model/validations/nested_spec.rb +93 -0
- data/spec/lib/active_data/model/validations_spec.rb +31 -0
- data/spec/lib/active_data/model_spec.rb +1 -32
- data/spec/lib/active_data_spec.rb +12 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/support/model_helpers.rb +10 -0
- metadata +246 -54
- data/gemfiles/Gemfile.rails-3 +0 -14
- data/lib/active_data/attributes/base.rb +0 -69
- data/lib/active_data/attributes/localized.rb +0 -42
- data/lib/active_data/model/associations/association.rb +0 -30
- data/lib/active_data/model/attributable.rb +0 -122
- data/lib/active_data/model/collectionizable.rb +0 -55
- data/lib/active_data/model/collectionizable/proxy.rb +0 -42
- data/lib/active_data/model/extensions.rb +0 -9
- data/lib/active_data/model/extensions/array.rb +0 -24
- data/lib/active_data/model/extensions/big_decimal.rb +0 -17
- data/lib/active_data/model/extensions/boolean.rb +0 -38
- data/lib/active_data/model/extensions/date.rb +0 -17
- data/lib/active_data/model/extensions/date_time.rb +0 -17
- data/lib/active_data/model/extensions/float.rb +0 -17
- data/lib/active_data/model/extensions/hash.rb +0 -22
- data/lib/active_data/model/extensions/integer.rb +0 -17
- data/lib/active_data/model/extensions/localized.rb +0 -22
- data/lib/active_data/model/extensions/object.rb +0 -17
- data/lib/active_data/model/extensions/string.rb +0 -17
- data/lib/active_data/model/extensions/time.rb +0 -17
- data/lib/active_data/model/localizable.rb +0 -31
- data/lib/active_data/model/nested_attributes.rb +0 -58
- data/lib/active_data/model/parameterizable.rb +0 -29
- data/lib/active_data/validations.rb +0 -7
- data/lib/active_data/validations/associated.rb +0 -17
- data/spec/lib/active_data/model/attributable_spec.rb +0 -191
- data/spec/lib/active_data/model/collectionizable_spec.rb +0 -60
- data/spec/lib/active_data/model/nested_attributes_spec.rb +0 -67
- data/spec/lib/active_data/model/type_cast_spec.rb +0 -116
- data/spec/lib/active_data/validations/associated_spec.rb +0 -88
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveData::Model::Validations::NestedValidator do
|
4
|
+
before do
|
5
|
+
stub_model(:validated_assoc) do
|
6
|
+
include ActiveData::Model
|
7
|
+
include ActiveData::Model::Lifecycle
|
8
|
+
|
9
|
+
attribute :name, String
|
10
|
+
|
11
|
+
validates_presence_of :name
|
12
|
+
end
|
13
|
+
|
14
|
+
stub_model(:unvalidated_assoc) do
|
15
|
+
include ActiveData::Model
|
16
|
+
include ActiveData::Model::Lifecycle
|
17
|
+
|
18
|
+
attribute :name, String
|
19
|
+
end
|
20
|
+
|
21
|
+
stub_model(:main) do
|
22
|
+
include ActiveData::Model::Persistence
|
23
|
+
include ActiveData::Model::Associations
|
24
|
+
|
25
|
+
attribute :name, String
|
26
|
+
|
27
|
+
validates_presence_of :name
|
28
|
+
|
29
|
+
embeds_one :validated_one, class_name: 'ValidatedAssoc'
|
30
|
+
embeds_one :unvalidated_one, class_name: 'UnvalidatedAssoc'
|
31
|
+
embeds_many :validated_many, class_name: 'ValidatedAssoc'
|
32
|
+
embeds_many :unvalidated_many, class_name: 'UnvalidatedAssoc'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context do
|
37
|
+
subject(:instance) { Main.instantiate name: 'hello', validated_one: { name: 'name' } }
|
38
|
+
it { is_expected.to be_valid }
|
39
|
+
end
|
40
|
+
|
41
|
+
context do
|
42
|
+
subject(:instance) { Main.instantiate name: 'hello', validated_one: { } }
|
43
|
+
it { is_expected.not_to be_valid }
|
44
|
+
specify { expect { instance.validate }.to change { instance.errors.messages }
|
45
|
+
.to(:'validated_one.name' => ["can't be blank"]) }
|
46
|
+
end
|
47
|
+
|
48
|
+
context do
|
49
|
+
subject(:instance) { Main.instantiate name: 'hello', unvalidated_one: { name: 'name' } }
|
50
|
+
it { is_expected.to be_valid }
|
51
|
+
end
|
52
|
+
|
53
|
+
context do
|
54
|
+
subject(:instance) { Main.instantiate name: 'hello', unvalidated_one: { } }
|
55
|
+
it { is_expected.to be_valid }
|
56
|
+
end
|
57
|
+
|
58
|
+
context do
|
59
|
+
subject(:instance) { Main.instantiate name: 'hello', validated_many: [{ name: 'name' }] }
|
60
|
+
it { is_expected.to be_valid }
|
61
|
+
end
|
62
|
+
|
63
|
+
context do
|
64
|
+
subject(:instance) { Main.instantiate name: 'hello', validated_many: [{ }] }
|
65
|
+
it { is_expected.not_to be_valid }
|
66
|
+
specify { expect { instance.validate }.to change { instance.errors.messages }
|
67
|
+
.to(:'validated_many.0.name' => ["can't be blank"]) }
|
68
|
+
end
|
69
|
+
|
70
|
+
context do
|
71
|
+
subject(:instance) { Main.instantiate name: 'hello', unvalidated_many: [{ name: 'name' }] }
|
72
|
+
it { is_expected.to be_valid }
|
73
|
+
end
|
74
|
+
|
75
|
+
context do
|
76
|
+
subject(:instance) { Main.instantiate name: 'hello', unvalidated_many: [{ }] }
|
77
|
+
it { is_expected.to be_valid }
|
78
|
+
end
|
79
|
+
|
80
|
+
context do
|
81
|
+
subject(:instance) { Main.instantiate name: 'hello', validated_many: [{ name: 'name' }], validated_one: { } }
|
82
|
+
it { is_expected.not_to be_valid }
|
83
|
+
specify { expect { instance.validate }.to change { instance.errors.messages }
|
84
|
+
.to(:'validated_one.name' => ["can't be blank"]) }
|
85
|
+
end
|
86
|
+
|
87
|
+
context do
|
88
|
+
subject(:instance) { Main.instantiate name: 'hello', validated_many: [{ }], validated_one: { name: 'name' } }
|
89
|
+
it { is_expected.not_to be_valid }
|
90
|
+
specify { expect { instance.validate }.to change { instance.errors.messages }
|
91
|
+
.to(:'validated_many.0.name' => ["can't be blank"]) }
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveData::Model::Validations do
|
4
|
+
let(:model) do
|
5
|
+
stub_model(:model) do
|
6
|
+
attribute :name, String
|
7
|
+
validates :name, presence: true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#errors' do
|
12
|
+
specify { expect(model.new.errors).to be_a ActiveModel::Errors }
|
13
|
+
specify { expect(model.new.errors).to be_empty }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#valid?' do
|
17
|
+
specify { expect(model.new).not_to be_valid }
|
18
|
+
specify { expect(model.new(name: 'Name')).to be_valid }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#invalid?' do
|
22
|
+
specify { expect(model.new).to be_invalid }
|
23
|
+
specify { expect(model.new(name: 'Name')).not_to be_invalid }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#validate!' do
|
27
|
+
specify { expect { model.new.validate! }.to raise_error ActiveData::ValidationError }
|
28
|
+
specify { expect(model.new(name: 'Name').validate!).to eq(true) }
|
29
|
+
specify { expect { model.new(name: 'Name').validate! }.not_to raise_error }
|
30
|
+
end
|
31
|
+
end
|
@@ -2,41 +2,10 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe ActiveData::Model do
|
5
|
-
let(:model)
|
6
|
-
Class.new do
|
7
|
-
include ActiveData::Model
|
8
|
-
|
9
|
-
attribute :name
|
10
|
-
attribute :count, default: 0
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
5
|
+
let(:model) { stub_model }
|
14
6
|
specify { expect { model.blablabla }.to raise_error NoMethodError }
|
15
|
-
specify { model.i18n_scope.should == :active_data }
|
16
|
-
specify { model.new.should_not be_persisted }
|
17
|
-
specify { model.instantiate({}).should be_an_instance_of model }
|
18
|
-
specify { model.instantiate({}).should be_persisted }
|
19
7
|
|
20
8
|
context 'Fault tolerance' do
|
21
9
|
specify{ expect { model.new(foo: 'bar') }.not_to raise_error }
|
22
10
|
end
|
23
|
-
|
24
|
-
describe '#instantiate' do
|
25
|
-
context do
|
26
|
-
subject(:instance) { model.instantiate(name: 'Hello', foo: 'Bar') }
|
27
|
-
|
28
|
-
specify { subject.instance_variable_get(:@attributes).should == { name: 'Hello', count: nil } }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#==' do
|
33
|
-
subject { model.new name: 'hello', count: 42 }
|
34
|
-
it { should_not == nil }
|
35
|
-
it { should_not == 'hello' }
|
36
|
-
it { should_not == Object.new }
|
37
|
-
it { should_not == model.new }
|
38
|
-
it { should_not == model.new(name: 'hello1', count: 42) }
|
39
|
-
it { should_not == model.new(name: 'hello', count: 42.1) }
|
40
|
-
it { should == model.new(name: 'hello', count: 42) }
|
41
|
-
end
|
42
11
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ActiveData do
|
5
|
+
specify { expect(subject).to respond_to :include_root_in_json }
|
6
|
+
specify { expect(subject).to respond_to :include_root_in_json= }
|
7
|
+
specify { expect(subject).to respond_to :i18n_scope }
|
8
|
+
specify { expect(subject).to respond_to :i18n_scope= }
|
9
|
+
specify { expect(subject).to respond_to :primary_attribute }
|
10
|
+
specify { expect(subject).to respond_to :primary_attribute= }
|
11
|
+
specify { expect(subject).to respond_to :normalizer }
|
12
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,45 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require
|
3
3
|
|
4
|
+
require 'rspec/its'
|
5
|
+
require 'active_record'
|
6
|
+
require 'database_cleaner'
|
7
|
+
|
8
|
+
require 'support/model_helpers'
|
9
|
+
|
10
|
+
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
|
11
|
+
ActiveRecord::Base.logger = Logger.new('/dev/null')
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define do
|
14
|
+
create_table :users do |t|
|
15
|
+
t.column :email, :string
|
16
|
+
t.column :projects, :text
|
17
|
+
t.column :profile, :text
|
18
|
+
end
|
19
|
+
|
20
|
+
create_table :authors do |t|
|
21
|
+
t.column :name, :string
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
4
25
|
RSpec.configure do |config|
|
5
26
|
config.mock_with :rspec
|
27
|
+
config.order = :random
|
28
|
+
config.run_all_when_everything_filtered = true
|
29
|
+
config.filter_run focus: true
|
30
|
+
|
31
|
+
config.include ModelHelpers
|
32
|
+
|
33
|
+
config.before(:suite) do
|
34
|
+
DatabaseCleaner.clean_with :truncation
|
35
|
+
DatabaseCleaner.strategy = :transaction
|
36
|
+
end
|
37
|
+
|
38
|
+
config.before do
|
39
|
+
DatabaseCleaner.start
|
40
|
+
end
|
41
|
+
|
42
|
+
config.after do
|
43
|
+
DatabaseCleaner.clean
|
44
|
+
end
|
6
45
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module ModelHelpers
|
2
|
+
def stub_model name = nil, superclass = nil, &block
|
3
|
+
stub_class(name, superclass) { include ActiveData::Model }.tap { |klass| klass.class_eval(&block) if block }
|
4
|
+
end
|
5
|
+
|
6
|
+
def stub_class name = nil, superclass = nil, &block
|
7
|
+
klass = superclass ? Class.new(superclass, &block) : Class.new(&block)
|
8
|
+
name.present? ? stub_const(name.to_s.camelize, klass) : klass
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,69 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pyromaniac
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: appraisal
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rspec-its
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
|
-
type: :
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
|
-
- -
|
80
|
+
- - ">="
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: database_cleaner
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activerecord
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: uuidtools
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: activesupport
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '4.0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4.0'
|
55
139
|
- !ruby/object:Gem::Dependency
|
56
140
|
name: activemodel
|
57
141
|
requirement: !ruby/object:Gem::Requirement
|
58
142
|
requirements:
|
59
|
-
- -
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '4.0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '4.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: tzinfo
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
60
158
|
- !ruby/object:Gem::Version
|
61
159
|
version: '0'
|
62
160
|
type: :runtime
|
63
161
|
prerelease: false
|
64
162
|
version_requirements: !ruby/object:Gem::Requirement
|
65
163
|
requirements:
|
66
|
-
- -
|
164
|
+
- - ">="
|
67
165
|
- !ruby/object:Gem::Version
|
68
166
|
version: '0'
|
69
167
|
description: Making object from any hash or hash array
|
@@ -73,57 +171,118 @@ executables: []
|
|
73
171
|
extensions: []
|
74
172
|
extra_rdoc_files: []
|
75
173
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .rspec
|
78
|
-
- .rvmrc
|
79
|
-
- .travis.yml
|
174
|
+
- ".gitignore"
|
175
|
+
- ".rspec"
|
176
|
+
- ".rvmrc"
|
177
|
+
- ".travis.yml"
|
178
|
+
- Appraisals
|
80
179
|
- Gemfile
|
81
180
|
- Guardfile
|
82
181
|
- LICENSE
|
83
182
|
- README.md
|
84
183
|
- Rakefile
|
85
184
|
- active_data.gemspec
|
86
|
-
- gemfiles/
|
185
|
+
- gemfiles/rails.4.0.gemfile
|
186
|
+
- gemfiles/rails.4.1.gemfile
|
187
|
+
- gemfiles/rails.4.2.gemfile
|
188
|
+
- gemfiles/rails.5.0.gemfile
|
87
189
|
- lib/active_data.rb
|
88
|
-
- lib/active_data/
|
89
|
-
- lib/active_data/
|
190
|
+
- lib/active_data/active_record/associations.rb
|
191
|
+
- lib/active_data/active_record/nested_attributes.rb
|
192
|
+
- lib/active_data/config.rb
|
193
|
+
- lib/active_data/errors.rb
|
194
|
+
- lib/active_data/extensions.rb
|
90
195
|
- lib/active_data/model.rb
|
91
196
|
- lib/active_data/model/associations.rb
|
92
|
-
- lib/active_data/model/associations/
|
197
|
+
- lib/active_data/model/associations/base.rb
|
198
|
+
- lib/active_data/model/associations/collection/embedded.rb
|
199
|
+
- lib/active_data/model/associations/collection/proxy.rb
|
200
|
+
- lib/active_data/model/associations/collection/referenced.rb
|
93
201
|
- lib/active_data/model/associations/embeds_many.rb
|
94
202
|
- lib/active_data/model/associations/embeds_one.rb
|
95
|
-
- lib/active_data/model/
|
96
|
-
- lib/active_data/model/
|
97
|
-
- lib/active_data/model/
|
98
|
-
- lib/active_data/model/
|
99
|
-
- lib/active_data/model/
|
100
|
-
- lib/active_data/model/
|
101
|
-
- lib/active_data/model/
|
102
|
-
- lib/active_data/model/
|
103
|
-
- lib/active_data/model/
|
104
|
-
- lib/active_data/model/
|
105
|
-
- lib/active_data/model/
|
106
|
-
- lib/active_data/model/
|
107
|
-
- lib/active_data/model/
|
108
|
-
- lib/active_data/model/
|
109
|
-
- lib/active_data/model/
|
110
|
-
- lib/active_data/model/
|
111
|
-
- lib/active_data/model/
|
112
|
-
- lib/active_data/model/
|
113
|
-
- lib/active_data/model/
|
114
|
-
- lib/active_data/
|
115
|
-
- lib/active_data/
|
203
|
+
- lib/active_data/model/associations/nested_attributes.rb
|
204
|
+
- lib/active_data/model/associations/references_many.rb
|
205
|
+
- lib/active_data/model/associations/references_one.rb
|
206
|
+
- lib/active_data/model/associations/reflections/base.rb
|
207
|
+
- lib/active_data/model/associations/reflections/embeds_many.rb
|
208
|
+
- lib/active_data/model/associations/reflections/embeds_one.rb
|
209
|
+
- lib/active_data/model/associations/reflections/reference_reflection.rb
|
210
|
+
- lib/active_data/model/associations/reflections/references_many.rb
|
211
|
+
- lib/active_data/model/associations/reflections/references_one.rb
|
212
|
+
- lib/active_data/model/associations/validations.rb
|
213
|
+
- lib/active_data/model/attributes.rb
|
214
|
+
- lib/active_data/model/attributes/attribute.rb
|
215
|
+
- lib/active_data/model/attributes/base.rb
|
216
|
+
- lib/active_data/model/attributes/collection.rb
|
217
|
+
- lib/active_data/model/attributes/dictionary.rb
|
218
|
+
- lib/active_data/model/attributes/localized.rb
|
219
|
+
- lib/active_data/model/attributes/reference_many.rb
|
220
|
+
- lib/active_data/model/attributes/reference_one.rb
|
221
|
+
- lib/active_data/model/attributes/reflections/attribute.rb
|
222
|
+
- lib/active_data/model/attributes/reflections/base.rb
|
223
|
+
- lib/active_data/model/attributes/reflections/collection.rb
|
224
|
+
- lib/active_data/model/attributes/reflections/dictionary.rb
|
225
|
+
- lib/active_data/model/attributes/reflections/localized.rb
|
226
|
+
- lib/active_data/model/attributes/reflections/reference_many.rb
|
227
|
+
- lib/active_data/model/attributes/reflections/reference_one.rb
|
228
|
+
- lib/active_data/model/attributes/reflections/represents.rb
|
229
|
+
- lib/active_data/model/attributes/represents.rb
|
230
|
+
- lib/active_data/model/callbacks.rb
|
231
|
+
- lib/active_data/model/conventions.rb
|
232
|
+
- lib/active_data/model/dirty.rb
|
233
|
+
- lib/active_data/model/lifecycle.rb
|
234
|
+
- lib/active_data/model/localization.rb
|
235
|
+
- lib/active_data/model/persistence.rb
|
236
|
+
- lib/active_data/model/primary.rb
|
237
|
+
- lib/active_data/model/scopes.rb
|
238
|
+
- lib/active_data/model/validations.rb
|
239
|
+
- lib/active_data/model/validations/associated.rb
|
240
|
+
- lib/active_data/model/validations/nested.rb
|
241
|
+
- lib/active_data/railtie.rb
|
116
242
|
- lib/active_data/version.rb
|
243
|
+
- spec/lib/active_data/active_record/associations_spec.rb
|
244
|
+
- spec/lib/active_data/active_record/nested_attributes_spec.rb
|
245
|
+
- spec/lib/active_data/config_spec.rb
|
117
246
|
- spec/lib/active_data/model/associations/embeds_many_spec.rb
|
118
247
|
- spec/lib/active_data/model/associations/embeds_one_spec.rb
|
119
|
-
- spec/lib/active_data/model/
|
248
|
+
- spec/lib/active_data/model/associations/nested_attributes_spec.rb
|
249
|
+
- spec/lib/active_data/model/associations/references_many_spec.rb
|
250
|
+
- spec/lib/active_data/model/associations/references_one_spec.rb
|
251
|
+
- spec/lib/active_data/model/associations/reflections/embeds_many_spec.rb
|
252
|
+
- spec/lib/active_data/model/associations/reflections/embeds_one_spec.rb
|
253
|
+
- spec/lib/active_data/model/associations/reflections/references_many_spec.rb
|
254
|
+
- spec/lib/active_data/model/associations/reflections/references_one_spec.rb
|
255
|
+
- spec/lib/active_data/model/associations/validations_spec.rb
|
256
|
+
- spec/lib/active_data/model/associations_spec.rb
|
257
|
+
- spec/lib/active_data/model/attributes/attribute_spec.rb
|
258
|
+
- spec/lib/active_data/model/attributes/base_spec.rb
|
259
|
+
- spec/lib/active_data/model/attributes/collection_spec.rb
|
260
|
+
- spec/lib/active_data/model/attributes/dictionary_spec.rb
|
120
261
|
- spec/lib/active_data/model/attributes/localized_spec.rb
|
121
|
-
- spec/lib/active_data/model/
|
122
|
-
- spec/lib/active_data/model/
|
123
|
-
- spec/lib/active_data/model/
|
262
|
+
- spec/lib/active_data/model/attributes/reflections/attribute_spec.rb
|
263
|
+
- spec/lib/active_data/model/attributes/reflections/base_spec.rb
|
264
|
+
- spec/lib/active_data/model/attributes/reflections/collection_spec.rb
|
265
|
+
- spec/lib/active_data/model/attributes/reflections/dictionary_spec.rb
|
266
|
+
- spec/lib/active_data/model/attributes/reflections/localized_spec.rb
|
267
|
+
- spec/lib/active_data/model/attributes/reflections/represents_spec.rb
|
268
|
+
- spec/lib/active_data/model/attributes/represents_spec.rb
|
269
|
+
- spec/lib/active_data/model/attributes_spec.rb
|
270
|
+
- spec/lib/active_data/model/callbacks_spec.rb
|
271
|
+
- spec/lib/active_data/model/conventions_spec.rb
|
272
|
+
- spec/lib/active_data/model/dirty_spec.rb
|
273
|
+
- spec/lib/active_data/model/lifecycle_spec.rb
|
274
|
+
- spec/lib/active_data/model/nested_attributes.rb
|
275
|
+
- spec/lib/active_data/model/persistence_spec.rb
|
276
|
+
- spec/lib/active_data/model/primary_spec.rb
|
277
|
+
- spec/lib/active_data/model/scopes_spec.rb
|
278
|
+
- spec/lib/active_data/model/typecasting_spec.rb
|
279
|
+
- spec/lib/active_data/model/validations/associated_spec.rb
|
280
|
+
- spec/lib/active_data/model/validations/nested_spec.rb
|
281
|
+
- spec/lib/active_data/model/validations_spec.rb
|
124
282
|
- spec/lib/active_data/model_spec.rb
|
125
|
-
- spec/lib/
|
283
|
+
- spec/lib/active_data_spec.rb
|
126
284
|
- spec/spec_helper.rb
|
285
|
+
- spec/support/model_helpers.rb
|
127
286
|
homepage: ''
|
128
287
|
licenses: []
|
129
288
|
metadata: {}
|
@@ -133,28 +292,61 @@ require_paths:
|
|
133
292
|
- lib
|
134
293
|
required_ruby_version: !ruby/object:Gem::Requirement
|
135
294
|
requirements:
|
136
|
-
- -
|
295
|
+
- - ">="
|
137
296
|
- !ruby/object:Gem::Version
|
138
297
|
version: '0'
|
139
298
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
299
|
requirements:
|
141
|
-
- -
|
300
|
+
- - ">="
|
142
301
|
- !ruby/object:Gem::Version
|
143
302
|
version: '0'
|
144
303
|
requirements: []
|
145
304
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
305
|
+
rubygems_version: 2.5.1
|
147
306
|
signing_key:
|
148
307
|
specification_version: 4
|
149
308
|
summary: Working with hashes in AR style
|
150
309
|
test_files:
|
310
|
+
- spec/lib/active_data/active_record/associations_spec.rb
|
311
|
+
- spec/lib/active_data/active_record/nested_attributes_spec.rb
|
312
|
+
- spec/lib/active_data/config_spec.rb
|
151
313
|
- spec/lib/active_data/model/associations/embeds_many_spec.rb
|
152
314
|
- spec/lib/active_data/model/associations/embeds_one_spec.rb
|
153
|
-
- spec/lib/active_data/model/
|
315
|
+
- spec/lib/active_data/model/associations/nested_attributes_spec.rb
|
316
|
+
- spec/lib/active_data/model/associations/references_many_spec.rb
|
317
|
+
- spec/lib/active_data/model/associations/references_one_spec.rb
|
318
|
+
- spec/lib/active_data/model/associations/reflections/embeds_many_spec.rb
|
319
|
+
- spec/lib/active_data/model/associations/reflections/embeds_one_spec.rb
|
320
|
+
- spec/lib/active_data/model/associations/reflections/references_many_spec.rb
|
321
|
+
- spec/lib/active_data/model/associations/reflections/references_one_spec.rb
|
322
|
+
- spec/lib/active_data/model/associations/validations_spec.rb
|
323
|
+
- spec/lib/active_data/model/associations_spec.rb
|
324
|
+
- spec/lib/active_data/model/attributes/attribute_spec.rb
|
325
|
+
- spec/lib/active_data/model/attributes/base_spec.rb
|
326
|
+
- spec/lib/active_data/model/attributes/collection_spec.rb
|
327
|
+
- spec/lib/active_data/model/attributes/dictionary_spec.rb
|
154
328
|
- spec/lib/active_data/model/attributes/localized_spec.rb
|
155
|
-
- spec/lib/active_data/model/
|
156
|
-
- spec/lib/active_data/model/
|
157
|
-
- spec/lib/active_data/model/
|
329
|
+
- spec/lib/active_data/model/attributes/reflections/attribute_spec.rb
|
330
|
+
- spec/lib/active_data/model/attributes/reflections/base_spec.rb
|
331
|
+
- spec/lib/active_data/model/attributes/reflections/collection_spec.rb
|
332
|
+
- spec/lib/active_data/model/attributes/reflections/dictionary_spec.rb
|
333
|
+
- spec/lib/active_data/model/attributes/reflections/localized_spec.rb
|
334
|
+
- spec/lib/active_data/model/attributes/reflections/represents_spec.rb
|
335
|
+
- spec/lib/active_data/model/attributes/represents_spec.rb
|
336
|
+
- spec/lib/active_data/model/attributes_spec.rb
|
337
|
+
- spec/lib/active_data/model/callbacks_spec.rb
|
338
|
+
- spec/lib/active_data/model/conventions_spec.rb
|
339
|
+
- spec/lib/active_data/model/dirty_spec.rb
|
340
|
+
- spec/lib/active_data/model/lifecycle_spec.rb
|
341
|
+
- spec/lib/active_data/model/nested_attributes.rb
|
342
|
+
- spec/lib/active_data/model/persistence_spec.rb
|
343
|
+
- spec/lib/active_data/model/primary_spec.rb
|
344
|
+
- spec/lib/active_data/model/scopes_spec.rb
|
345
|
+
- spec/lib/active_data/model/typecasting_spec.rb
|
346
|
+
- spec/lib/active_data/model/validations/associated_spec.rb
|
347
|
+
- spec/lib/active_data/model/validations/nested_spec.rb
|
348
|
+
- spec/lib/active_data/model/validations_spec.rb
|
158
349
|
- spec/lib/active_data/model_spec.rb
|
159
|
-
- spec/lib/
|
350
|
+
- spec/lib/active_data_spec.rb
|
160
351
|
- spec/spec_helper.rb
|
352
|
+
- spec/support/model_helpers.rb
|