vidibus-inheritance 0.3.6 → 0.3.9

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.
@@ -1,27 +1,25 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "Vidibus::Inheritance::Validators::AncestorValidator" do
4
- class ValidModel
5
- include ActiveModel::Validations
6
- attr_accessor :ancestor
7
- validates :ancestor, :ancestor => true
8
- end
9
-
10
- class InvalidModel; end
11
-
12
- let(:model) { ValidModel.new }
3
+ describe "Vidibus::Inheritance::Validators::AncestorValidator" do
4
+ let(:model) { ValidatedModel.new }
13
5
 
14
6
  it "should be available as ancestor validator" do
15
7
  Model.validators_on(:ancestor).first.should be_a_kind_of(Vidibus::Inheritance::Validators::AncestorValidator)
16
8
  end
17
9
 
18
10
  it "should validate an ancestor of same class" do
19
- model.ancestor = ValidModel.new
11
+ model.ancestor = ValidatedModel.new
20
12
  model.valid?.should be_true
21
13
  end
22
14
 
23
- it "should add an error, if ancestor is of a different class" do
24
- model.ancestor = InvalidModel.new
15
+ it "should add an error if ancestor is of a different class" do
16
+ model.ancestor = Clerk.new
17
+ model.valid?.should be_false
18
+ model.errors[:ancestor].should_not be_blank
19
+ end
20
+
21
+ it "should add an error if ancestor is of a subclass" do
22
+ model.ancestor = ValidatedModelSubclass.new
25
23
  model.valid?.should be_false
26
24
  model.errors[:ancestor].should_not be_blank
27
25
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vidibus-inheritance}
8
- s.version = "0.3.6"
8
+ s.version = "0.3.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andre Pankratz"]
12
- s.date = %q{2010-08-09}
12
+ s.date = %q{2010-08-11}
13
13
  s.description = %q{This gem allows inheritance of objects for Rails 3 with Mongoid. It will update all attributes and embedded documents of inheritors when ancestor gets changed.}
14
14
  s.email = %q{andre@vidibus.com}
15
15
  s.extra_rdoc_files = [
@@ -30,8 +30,10 @@ Gem::Specification.new do |s|
30
30
  "lib/vidibus/inheritance/mongoid.rb",
31
31
  "lib/vidibus/inheritance/validators.rb",
32
32
  "lib/vidibus/inheritance/validators/ancestor_validator.rb",
33
+ "spec/models.rb",
33
34
  "spec/spec.opts",
34
35
  "spec/spec_helper.rb",
36
+ "spec/vidibus/inheritance/inheritance_spec.rb",
35
37
  "spec/vidibus/inheritance/mongoid_spec.rb",
36
38
  "spec/vidibus/inheritance/validators/ancestor_validator_spec.rb",
37
39
  "vidibus-inheritance.gemspec"
@@ -42,7 +44,9 @@ Gem::Specification.new do |s|
42
44
  s.rubygems_version = %q{1.3.7}
43
45
  s.summary = %q{Provides inheritance for models.}
44
46
  s.test_files = [
45
- "spec/spec_helper.rb",
47
+ "spec/models.rb",
48
+ "spec/spec_helper.rb",
49
+ "spec/vidibus/inheritance/inheritance_spec.rb",
46
50
  "spec/vidibus/inheritance/mongoid_spec.rb",
47
51
  "spec/vidibus/inheritance/validators/ancestor_validator_spec.rb"
48
52
  ]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidibus-inheritance
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 6
10
- version: 0.3.6
9
+ - 9
10
+ version: 0.3.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andre Pankratz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-09 00:00:00 +02:00
18
+ date: 2010-08-11 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -131,8 +131,10 @@ files:
131
131
  - lib/vidibus/inheritance/mongoid.rb
132
132
  - lib/vidibus/inheritance/validators.rb
133
133
  - lib/vidibus/inheritance/validators/ancestor_validator.rb
134
+ - spec/models.rb
134
135
  - spec/spec.opts
135
136
  - spec/spec_helper.rb
137
+ - spec/vidibus/inheritance/inheritance_spec.rb
136
138
  - spec/vidibus/inheritance/mongoid_spec.rb
137
139
  - spec/vidibus/inheritance/validators/ancestor_validator_spec.rb
138
140
  - vidibus-inheritance.gemspec
@@ -171,6 +173,8 @@ signing_key:
171
173
  specification_version: 3
172
174
  summary: Provides inheritance for models.
173
175
  test_files:
176
+ - spec/models.rb
174
177
  - spec/spec_helper.rb
178
+ - spec/vidibus/inheritance/inheritance_spec.rb
175
179
  - spec/vidibus/inheritance/mongoid_spec.rb
176
180
  - spec/vidibus/inheritance/validators/ancestor_validator_spec.rb