dm-active_model 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -25,20 +25,20 @@
25
25
  active_model/lint itself isn't really strict about what exact
26
26
  String it gets back from either of the following methods that
27
27
  are supported by the object returned from #class.model_name
28
-
28
+
29
29
  #singular
30
30
  #plural
31
31
  #element
32
32
  #human
33
33
  #collection
34
34
  #partial_path
35
-
35
+
36
36
  All lint cares about, is that these methods return Strings
37
-
37
+
38
38
  Therefore it's probably best to push specs that test for
39
39
  rails's own implementation of those active_model strings
40
40
  down to something like rails_datamapper.
41
-
41
+
42
42
  Currently the rails compliance specs for #collection and
43
43
  #partial_path fail. Need to investigate this.
44
44
 
@@ -55,7 +55,7 @@
55
55
  DataMapper::Validate::ValidationErrors seems to implement
56
56
  #[](field) in an incompatible way. This will need more
57
57
  investigation.
58
-
58
+
59
59
  If this can be fixed upstream, all specs should pass
60
60
 
61
61
  [4b1ccd0 | Wed Sep 23 22:37:59 UTC 2009] snusnu <gamsnjaga@gmail.com>
@@ -66,7 +66,7 @@
66
66
  to perform the compliance tests. However, lint.rb still
67
67
  needs to be updated to cover the intended behavior more
68
68
  precisely.
69
-
69
+
70
70
  Nevertheless, next step is to include active_model as a
71
71
  development dependency and run both lint.rb and our own
72
72
  specs for the time being.
@@ -74,4 +74,3 @@
74
74
  [2eb914c | Wed Sep 23 18:23:27 UTC 2009] snusnu <gamsnjaga@gmail.com>
75
75
 
76
76
  * Initial commit to dm-active_model.
77
-
data/README.rdoc CHANGED
@@ -3,7 +3,7 @@
3
3
  This plugin makes datamapper compliant with active_model conventions and thus compatible with rails3.
4
4
 
5
5
  == Note on Patches/Pull Requests
6
-
6
+
7
7
  * Fork the project.
8
8
  * Make your feature addition or bug fix.
9
9
  * Add tests for it. This is important so I don't break it in a
data/Rakefile CHANGED
@@ -3,8 +3,6 @@ require 'rake'
3
3
 
4
4
  require File.expand_path('../lib/dm-active_model/version', __FILE__)
5
5
 
6
- FileList['tasks/**/*.rake'].each { |task| load task }
7
-
8
6
  begin
9
7
 
10
8
  gem 'jeweler', '~> 1.4'
@@ -30,6 +28,7 @@ begin
30
28
 
31
29
  Jeweler::GemcutterTasks.new
32
30
 
31
+ FileList['tasks/**/*.rake'].each { |task| import task }
33
32
  rescue LoadError
34
33
  puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
35
34
  end
@@ -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.0.2"
8
+ s.version = "0.1.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{2009-12-20}
12
+ s.date = %q{2009-12-29}
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 = [
@@ -1,7 +1,7 @@
1
1
  module DataMapper
2
2
  module ActiveModel
3
3
 
4
- VERSION = '0.0.2'.freeze
4
+ VERSION = '0.1.0'.freeze
5
5
 
6
6
  end
7
7
  end
@@ -13,7 +13,7 @@ module DataMapper
13
13
  @singular = Extlib::Inflection.underscore(self).tr('/', '_').freeze
14
14
  @plural = Extlib::Inflection.pluralize(@singular).freeze
15
15
  @element = Extlib::Inflection.underscore(Extlib::Inflection.demodulize(self)).freeze
16
- @human = @element.gsub(/_/, " ")
16
+ @human = Extlib::Inflection.humanize(@element)
17
17
  @collection = Extlib::Inflection.pluralize(Extlib::Inflection.underscore(self)).freeze
18
18
  @partial_path = "#{@collection}/#{@element}".freeze
19
19
  end
@@ -1,7 +1,26 @@
1
- describe 'every active_model compliant object', :shared => true do
1
+ require 'spec/test/unit'
2
2
 
3
- it 'must pass the official active_model/lint test' do
4
- ActiveModel::Lint.test(@object).should be_passed
3
+ share_examples_for 'an active_model compliant object' do
4
+ include ActiveModel::Lint::Tests
5
+
6
+ it 'must implement the #valid? interface' do
7
+ test_valid?
8
+ end
9
+
10
+ it 'must implement the #new_record? interface' do
11
+ test_new_record?
12
+ end
13
+
14
+ it 'must implement the #destroyed? interface' do
15
+ test_destroyed?
16
+ end
17
+
18
+ it 'must implement the #destroyed? interface' do
19
+ test_destroyed?
5
20
  end
6
21
 
22
+ it 'must implement the #errors interface' do
23
+ test_errors_aref
24
+ test_errors_full_messages
25
+ end
7
26
  end
@@ -17,9 +17,9 @@ describe 'An active_model compliant DataMapper::Resource' do
17
17
  end
18
18
 
19
19
  before :each do
20
- @object = ComplianceTest::ProfileInfo.create.to_model
20
+ @model = ComplianceTest::ProfileInfo.create.to_model
21
21
  end
22
22
 
23
- it_should_behave_like 'every active_model compliant object'
23
+ it_should_behave_like 'an active_model compliant object'
24
24
 
25
25
  end
@@ -18,33 +18,33 @@ describe 'An active_model compliant DataMapper::Resource that is compatible with
18
18
  end
19
19
 
20
20
  before :each do
21
- @object = ComplianceTest::ProfileInfo.create.to_model
21
+ @model = ComplianceTest::ProfileInfo.create.to_model
22
22
  end
23
23
 
24
- it_should_behave_like 'every active_model compliant object'
24
+ it_should_behave_like 'an active_model compliant object'
25
25
 
26
26
  it '#class.model_name.singular should follow active_model conventions' do
27
- @object.class.model_name.singular.should == ActiveModel::Name.new(@object.class.name).singular
27
+ @model.class.model_name.singular.should == ActiveModel::Name.new(@model.class).singular
28
28
  end
29
29
 
30
30
  it '#class.model_name.plural should follow active_model conventions' do
31
- @object.class.model_name.plural.should == ActiveModel::Name.new(@object.class.name).plural
31
+ @model.class.model_name.plural.should == ActiveModel::Name.new(@model.class).plural
32
32
  end
33
33
 
34
34
  it '#class.model_name.element should follow active_model conventions' do
35
- @object.class.model_name.element.should == ActiveModel::Name.new(@object.class.name).element
35
+ @model.class.model_name.element.should == ActiveModel::Name.new(@model.class).element
36
36
  end
37
37
 
38
38
  it '#class.model_name.human should follow active_model conventions' do
39
- @object.class.model_name.human.should == ActiveModel::Name.new(@object.class.name).human
39
+ @model.class.model_name.human.should == ActiveModel::Name.new(@model.class).human
40
40
  end
41
41
 
42
42
  it '#class.model_name.collection should follow active_model conventions' do
43
- @object.class.model_name.collection.should == ActiveModel::Name.new(@object.class.name).collection
43
+ @model.class.model_name.collection.should == ActiveModel::Name.new(@model.class).collection
44
44
  end
45
45
 
46
46
  it '#class.model_name.partial_path should follow active_model conventions' do
47
- @object.class.model_name.partial_path.should == ActiveModel::Name.new(@object.class.name).partial_path
47
+ @model.class.model_name.partial_path.should == ActiveModel::Name.new(@model.class).partial_path
48
48
  end
49
49
 
50
- end
50
+ end
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.0.2
4
+ version: 0.1.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: 2009-12-20 00:00:00 +01:00
12
+ date: 2009-12-29 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency