dm-active_model 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -21,8 +21,8 @@ begin
21
21
 
22
22
  gem.add_dependency 'dm-core', '~> 0.10'
23
23
 
24
- gem.add_development_dependency 'rspec', '~> 1.2.9'
25
- gem.add_development_dependency 'yard', '~> 0.4.0'
24
+ gem.add_development_dependency 'rspec', '>= 1.2.9'
25
+ gem.add_development_dependency 'yard', '~> 0.5'
26
26
 
27
27
  end
28
28
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dm-active_model}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Martin Gamsjaeger (snusnu)"]
12
- s.date = %q{2010-01-14}
12
+ s.date = %q{2010-01-20}
13
13
  s.description = %q{A datamapper plugin for active_model compliance and thus rails 3 compatibility.}
14
14
  s.email = %q{gamsnjaga [a] gmail [d] com}
15
15
  s.extra_rdoc_files = [
@@ -27,11 +27,9 @@ Gem::Specification.new do |s|
27
27
  "TODO",
28
28
  "dm-active_model.gemspec",
29
29
  "lib/dm-active_model.rb",
30
- "lib/dm-active_model/extlib.rb",
31
30
  "lib/dm-active_model/version.rb",
32
31
  "spec/amo_compliance_spec.rb",
33
32
  "spec/dm-active_model_spec.rb",
34
- "spec/rails_compliance_spec.rb",
35
33
  "spec/rcov.opts",
36
34
  "spec/spec.opts",
37
35
  "spec/spec_helper.rb",
@@ -50,7 +48,6 @@ Gem::Specification.new do |s|
50
48
  s.test_files = [
51
49
  "spec/amo_compliance_spec.rb",
52
50
  "spec/dm-active_model_spec.rb",
53
- "spec/rails_compliance_spec.rb",
54
51
  "spec/spec_helper.rb"
55
52
  ]
56
53
 
@@ -60,17 +57,17 @@ Gem::Specification.new do |s|
60
57
 
61
58
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
62
59
  s.add_runtime_dependency(%q<dm-core>, ["~> 0.10"])
63
- s.add_development_dependency(%q<rspec>, ["~> 1.2.9"])
64
- s.add_development_dependency(%q<yard>, ["~> 0.4.0"])
60
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
61
+ s.add_development_dependency(%q<yard>, ["~> 0.5"])
65
62
  else
66
63
  s.add_dependency(%q<dm-core>, ["~> 0.10"])
67
- s.add_dependency(%q<rspec>, ["~> 1.2.9"])
68
- s.add_dependency(%q<yard>, ["~> 0.4.0"])
64
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
65
+ s.add_dependency(%q<yard>, ["~> 0.5"])
69
66
  end
70
67
  else
71
68
  s.add_dependency(%q<dm-core>, ["~> 0.10"])
72
- s.add_dependency(%q<rspec>, ["~> 1.2.9"])
73
- s.add_dependency(%q<yard>, ["~> 0.4.0"])
69
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
70
+ s.add_dependency(%q<yard>, ["~> 0.5"])
74
71
  end
75
72
  end
76
73
 
@@ -1,8 +1,4 @@
1
- if Object.const_defined?('Extlib')
2
- require 'dm-active_model/extlib'
3
- else
4
- require 'active_model/naming'
5
- end
1
+ require 'active_model/naming'
6
2
 
7
3
  module DataMapper
8
4
  module ActiveModel
@@ -19,7 +15,6 @@ module DataMapper
19
15
 
20
16
  module InstanceMethods
21
17
 
22
-
23
18
  def self.included(host)
24
19
  host.class_eval do
25
20
  alias :new_record? :new?
@@ -1,7 +1,7 @@
1
1
  module DataMapper
2
2
  module ActiveModel
3
3
 
4
- VERSION = '0.2.0'.freeze
4
+ VERSION = '0.3.0'.freeze
5
5
 
6
6
  end
7
7
  end
@@ -1,6 +1,14 @@
1
1
  require 'spec/test/unit'
2
2
 
3
+ # This must be kept in sync with active_model/lint tests
4
+ # at least for as long as
5
+ #
6
+ # http://rspec.lighthouseapp.com/projects/5645/tickets/900
7
+ #
8
+ # isn't resolved in some way (probably with rspec2)
9
+
3
10
  share_examples_for 'an active_model compliant object' do
11
+
4
12
  include ActiveModel::Lint::Tests
5
13
 
6
14
  it 'must implement the #valid? interface' do
@@ -15,12 +23,13 @@ share_examples_for 'an active_model compliant object' do
15
23
  test_destroyed?
16
24
  end
17
25
 
18
- it 'must implement the #destroyed? interface' do
19
- test_destroyed?
26
+ it 'must implement the #model_naming interface' do
27
+ test_model_naming
20
28
  end
21
29
 
22
30
  it 'must implement the #errors interface' do
23
31
  test_errors_aref
24
32
  test_errors_full_messages
25
33
  end
34
+
26
35
  end
data/spec/spec_helper.rb CHANGED
@@ -1,19 +1,16 @@
1
1
  require 'rubygems'
2
2
 
3
3
  # Use local dm-core if running from a typical dev checkout.
4
- lib = File.join('..', '..', 'dm-core', 'lib')
4
+ lib = File.expand_path('../../../dm-core/lib', __FILE__)
5
5
  $LOAD_PATH.unshift(lib) if File.directory?(lib)
6
6
  require 'dm-core'
7
7
 
8
- # Support running specs with 'rake spec' and 'spec'
9
- $LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib')
10
-
11
- require 'dm-active_model'
12
-
13
- # test with official active_model lint
8
+ # Use local active_model if running from a typical dev checkout.
9
+ lib = File.expand_path('../../../rails/activemodel/lib', __FILE__)
10
+ $LOAD_PATH.unshift(lib) if File.directory?(lib)
14
11
  require 'active_model/lint'
15
12
 
16
- # run our own specs for the time being. lint still needs to be updated
13
+ require 'dm-active_model'
17
14
  require 'amo_compliance_spec'
18
15
 
19
16
  def load_driver(name, default_uri)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-active_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Gamsjaeger (snusnu)
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-14 00:00:00 +01:00
12
+ date: 2010-01-20 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -28,7 +28,7 @@ dependencies:
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.2.9
34
34
  version:
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.4.0
43
+ version: "0.5"
44
44
  version:
45
45
  description: A datamapper plugin for active_model compliance and thus rails 3 compatibility.
46
46
  email: gamsnjaga [a] gmail [d] com
@@ -62,11 +62,9 @@ files:
62
62
  - TODO
63
63
  - dm-active_model.gemspec
64
64
  - lib/dm-active_model.rb
65
- - lib/dm-active_model/extlib.rb
66
65
  - lib/dm-active_model/version.rb
67
66
  - spec/amo_compliance_spec.rb
68
67
  - spec/dm-active_model_spec.rb
69
- - spec/rails_compliance_spec.rb
70
68
  - spec/rcov.opts
71
69
  - spec/spec.opts
72
70
  - spec/spec_helper.rb
@@ -107,5 +105,4 @@ summary: active_model compliance for datamapper
107
105
  test_files:
108
106
  - spec/amo_compliance_spec.rb
109
107
  - spec/dm-active_model_spec.rb
110
- - spec/rails_compliance_spec.rb
111
108
  - spec/spec_helper.rb
@@ -1,28 +0,0 @@
1
- require 'extlib/inflection'
2
-
3
- module ActiveSupport
4
- Inflector = Extlib::Inflection
5
- end
6
-
7
- module ActiveModel
8
-
9
- # This is mostly copied from active_model and adapted to use extlib under the hood.
10
- # see http://github.com/rails/rails/blob/master/activemodel/lib/active_model/naming.rb
11
- class Name < String
12
-
13
- attr_reader :singular, :plural, :element, :collection, :partial_path, :human
14
- alias_method :cache_key, :collection
15
-
16
- def initialize(klass)
17
- super(klass.name)
18
- @singular = Extlib::Inflection.underscore(self).tr('/', '_').freeze
19
- @plural = Extlib::Inflection.pluralize(@singular).freeze
20
- @element = Extlib::Inflection.underscore(Extlib::Inflection.demodulize(self)).freeze
21
- @human = Extlib::Inflection.humanize(@element)
22
- @collection = Extlib::Inflection.pluralize(Extlib::Inflection.underscore(self)).freeze
23
- @partial_path = "#{@collection}/#{@element}".freeze
24
- end
25
-
26
- end
27
-
28
- end
@@ -1,50 +0,0 @@
1
- # TODO move these specs into rails_datamapper
2
- require 'active_model/naming'
3
-
4
- describe 'An active_model compliant DataMapper::Resource that is compatible with rails3' do
5
-
6
- before :all do
7
-
8
- module ComplianceTest
9
- class ProfileInfo
10
- include DataMapper::Resource
11
- property :id, Serial
12
- end
13
- end
14
-
15
- DataMapper.setup(:default, 'sqlite3::memory:')
16
- DataMapper.auto_migrate!
17
-
18
- end
19
-
20
- before :each do
21
- @model = ComplianceTest::ProfileInfo.create.to_model
22
- end
23
-
24
- it_should_behave_like 'an active_model compliant object'
25
-
26
- it '#class.model_name.singular should follow active_model conventions' do
27
- @model.class.model_name.singular.should == ActiveModel::Name.new(@model.class).singular
28
- end
29
-
30
- it '#class.model_name.plural should follow active_model conventions' do
31
- @model.class.model_name.plural.should == ActiveModel::Name.new(@model.class).plural
32
- end
33
-
34
- it '#class.model_name.element should follow active_model conventions' do
35
- @model.class.model_name.element.should == ActiveModel::Name.new(@model.class).element
36
- end
37
-
38
- it '#class.model_name.human should follow active_model conventions' do
39
- @model.class.model_name.human.should == ActiveModel::Name.new(@model.class).human
40
- end
41
-
42
- it '#class.model_name.collection should follow active_model conventions' do
43
- @model.class.model_name.collection.should == ActiveModel::Name.new(@model.class).collection
44
- end
45
-
46
- it '#class.model_name.partial_path should follow active_model conventions' do
47
- @model.class.model_name.partial_path.should == ActiveModel::Name.new(@model.class).partial_path
48
- end
49
-
50
- end