ardm-active_model 1.2.0 → 1.3.0
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/Gemfile +2 -3
- data/lib/dm-active_model.rb +6 -0
- data/lib/dm-active_model/version.rb +1 -1
- data/spec/amo_interface_compliance_spec.rb +5 -24
- data/spec/amo_validation_compliance_spec.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6f6c4708c51eff3663adead13142aedd6002044
|
|
4
|
+
data.tar.gz: b13e5c582565bc89febb650846d3141d960df832
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee28484dc877534d9255f7a071414ccca6f133a77bca7f822b18e0ee9ac966ba739bedc27cc89670e6f215db069ce8a4e42fd785887b897b294fc0a3f6501437
|
|
7
|
+
data.tar.gz: 5ffc7d460670092e8794e5fa932c801913fc50f8cc6a457693a4017fb3faf1df4d75499925b1bc4a944bd0edde3bbedb5425955ac3ab39588b6b204a9823c83e
|
data/Gemfile
CHANGED
|
@@ -7,12 +7,11 @@ gemspec
|
|
|
7
7
|
SOURCE = ENV.fetch('SOURCE', :git).to_sym
|
|
8
8
|
REPO_POSTFIX = SOURCE == :path ? '' : '.git'
|
|
9
9
|
DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'https://github.com/ar-dm'
|
|
10
|
-
DM_VERSION = '~> 1.2
|
|
10
|
+
DM_VERSION = '~> 1.2'
|
|
11
11
|
CURRENT_BRANCH = ENV.fetch('GIT_BRANCH', 'master')
|
|
12
|
-
RAILS_VERSION = '
|
|
12
|
+
RAILS_VERSION = [ '>= 3.0', '< 5.0' ]
|
|
13
13
|
|
|
14
14
|
gem 'ardm-core', DM_VERSION, SOURCE => "#{DATAMAPPER}/ardm-core#{REPO_POSTFIX}", :branch => CURRENT_BRANCH
|
|
15
|
-
|
|
16
15
|
gem 'activemodel', RAILS_VERSION, :require => nil
|
|
17
16
|
|
|
18
17
|
group :development do
|
data/lib/dm-active_model.rb
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
require 'dm-core'
|
|
2
|
+
require 'active_support/core_ext/module/delegation' # needed by active_model/naming
|
|
3
|
+
require 'active_support/core_ext/module/remove_method' # needed for Module.remove_possible_method in active_model/naming.rb (active_model ~> 4.1)
|
|
4
|
+
require 'active_support/concern' # needed by active_model/conversion
|
|
2
5
|
require 'active_model/naming'
|
|
6
|
+
require 'active_model/conversion'
|
|
3
7
|
|
|
4
8
|
module DataMapper
|
|
5
9
|
module ActiveModel
|
|
6
10
|
|
|
7
11
|
module InstanceMethods
|
|
12
|
+
include ::ActiveModel::Conversion
|
|
8
13
|
|
|
9
14
|
def to_model
|
|
10
15
|
self
|
|
@@ -50,6 +55,7 @@ module DataMapper
|
|
|
50
55
|
end
|
|
51
56
|
|
|
52
57
|
Model.append_extensions(::ActiveModel::Naming)
|
|
58
|
+
Model.append_extensions(::ActiveModel::Conversion::ClassMethods)
|
|
53
59
|
Model.append_inclusions(ActiveModel::InstanceMethods)
|
|
54
60
|
|
|
55
61
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'spec/test/unit'
|
|
2
|
+
require 'active_support/core_ext/object/blank' # needed by active_model/lint
|
|
2
3
|
require 'active_model/lint'
|
|
3
4
|
|
|
4
5
|
# This must be kept in sync with active_model/lint tests
|
|
@@ -12,29 +13,9 @@ share_examples_for 'an active_model compliant object' do
|
|
|
12
13
|
|
|
13
14
|
include ActiveModel::Lint::Tests
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
instance_methods.grep(/^test_/).each do |meth|
|
|
17
|
+
it meth.to_s do
|
|
18
|
+
send(meth)
|
|
19
|
+
end
|
|
17
20
|
end
|
|
18
|
-
|
|
19
|
-
it 'must implement the #to_param interface' do
|
|
20
|
-
test_to_param
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it 'must implement the #valid? interface' do
|
|
24
|
-
test_valid?
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it 'must implement the #persisted? interface' do
|
|
28
|
-
test_persisted?
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'must implement the #model_naming interface' do
|
|
32
|
-
test_model_naming
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it 'must implement the #errors interface' do
|
|
36
|
-
test_errors_aref
|
|
37
|
-
test_errors_full_messages
|
|
38
|
-
end
|
|
39
|
-
|
|
40
21
|
end
|