djsun-mongomapper 0.3.5 → 0.3.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,6 +32,16 @@ module MongoMapper
32
32
  raise NotImplementedError
33
33
  end
34
34
 
35
+ def inspect
36
+ load_target
37
+ @target.inspect
38
+ end
39
+
40
+ def nil?
41
+ load_target
42
+ @target.nil?
43
+ end
44
+
35
45
  protected
36
46
  def method_missing(method, *args)
37
47
  if load_target
data/mongomapper.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongomapper}
8
- s.version = "0.3.5"
8
+ s.version = "0.3.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["John Nunemaker"]
@@ -9,6 +9,7 @@ class BelongsToPolymorphicProxyTest < Test::Unit::TestCase
9
9
  should "default to nil" do
10
10
  status = Status.new
11
11
  status.target.should be_nil
12
+ status.target.inspect.should == "nil"
12
13
  end
13
14
 
14
15
  should "be able to replace the association" do
@@ -19,6 +20,7 @@ class BelongsToPolymorphicProxyTest < Test::Unit::TestCase
19
20
 
20
21
  from_db = Status.find(status.id)
21
22
  from_db.target.should_not be_nil
23
+ from_db.target.inspect.should_not be_empty
22
24
  from_db.target_id.should == project.id
23
25
  from_db.target_type.should == "Project"
24
26
  from_db.target.name.should == "mongomapper"
@@ -35,6 +37,7 @@ class BelongsToPolymorphicProxyTest < Test::Unit::TestCase
35
37
  from_db.target_type.should be_nil
36
38
  from_db.target_id.should be_nil
37
39
  from_db.target.should be_nil
40
+ from_db.target.inspect.should == "nil"
38
41
  end
39
42
 
40
43
  context "association id set but document not found" do
@@ -48,6 +51,7 @@ class BelongsToPolymorphicProxyTest < Test::Unit::TestCase
48
51
 
49
52
  should "return nil instead of raising error" do
50
53
  @status.target.should be_nil
54
+ @status.target.inspect.should == "nil"
51
55
  end
52
56
  end
53
57
  end
@@ -9,6 +9,7 @@ class BelongsToProxyTest < Test::Unit::TestCase
9
9
  should "default to nil" do
10
10
  status = Status.new
11
11
  status.project.should be_nil
12
+ status.project.inspect.should == "nil"
12
13
  end
13
14
 
14
15
  should "be able to replace the association" do
@@ -19,6 +20,7 @@ class BelongsToProxyTest < Test::Unit::TestCase
19
20
 
20
21
  from_db = Status.find(status.id)
21
22
  from_db.project.should_not be_nil
23
+ from_db.project.inspect.should_not be_empty
22
24
  from_db.project.name.should == "mongomapper"
23
25
  end
24
26
 
@@ -31,6 +33,7 @@ class BelongsToProxyTest < Test::Unit::TestCase
31
33
  from_db = Status.find(status.id)
32
34
  from_db.project = nil
33
35
  from_db.project.should be_nil
36
+ from_db.project.inspect.should == "nil"
34
37
  end
35
38
 
36
39
  context "association id set but document not found" do
@@ -40,6 +43,7 @@ class BelongsToProxyTest < Test::Unit::TestCase
40
43
 
41
44
  should "return nil instead of raising error" do
42
45
  @status.project.should be_nil
46
+ @status.project.inspect.should == "nil"
43
47
  end
44
48
  end
45
49
  end
@@ -8,6 +8,7 @@ class ManyDocumentsAsProxyTest < Test::Unit::TestCase
8
8
 
9
9
  should "default reader to empty array" do
10
10
  Post.new.comments.should == []
11
+ Post.new.comments.inspect.should == "[]"
11
12
  end
12
13
 
13
14
  should "add type and id key to polymorphic class base" do
@@ -7,8 +7,8 @@ class ManyEmbeddedPolymorphicProxyTest < Test::Unit::TestCase
7
7
  end
8
8
 
9
9
  should "default reader to empty array" do
10
- catalog = Catalog.new
11
- catalog.medias.should == []
10
+ Catalog.new.medias.should == []
11
+ Catalog.new.medias.inspect.should == "[]"
12
12
  end
13
13
 
14
14
  should "allow adding to association like it was an array" do
@@ -87,8 +87,8 @@ class ManyEmbeddedPolymorphicProxyTest < Test::Unit::TestCase
87
87
  end
88
88
 
89
89
  should "default reader to empty array" do
90
- fleet = TrModels::Fleet.new
91
- fleet.transports.should == []
90
+ TrModels::Fleet.new.transports.should == []
91
+ TrModels::Fleet.new.transports.inspect.should == "[]"
92
92
  end
93
93
 
94
94
  should "allow adding to association like it was an array" do
@@ -8,6 +8,7 @@ class ManyEmbeddedProxyTest < Test::Unit::TestCase
8
8
 
9
9
  should "default reader to empty array" do
10
10
  Project.new.addresses.should == []
11
+ Project.new.addresses.inspect.should == "[]"
11
12
  end
12
13
 
13
14
  should "allow adding to association like it was an array" do
@@ -8,6 +8,7 @@ class ManyPolymorphicProxyTest < Test::Unit::TestCase
8
8
 
9
9
  should "default reader to empty array" do
10
10
  Room.new.messages.should == []
11
+ Room.new.messages.inspect.should == "[]"
11
12
  end
12
13
 
13
14
  should "add type key to polymorphic class base" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: djsun-mongomapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
@@ -137,6 +137,7 @@ files:
137
137
  - test/unit/test_validations.rb
138
138
  has_rdoc: false
139
139
  homepage: http://github.com/jnunemaker/mongomapper
140
+ licenses:
140
141
  post_install_message:
141
142
  rdoc_options:
142
143
  - --charset=UTF-8
@@ -157,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
158
  requirements: []
158
159
 
159
160
  rubyforge_project: mongomapper
160
- rubygems_version: 1.2.0
161
+ rubygems_version: 1.3.5
161
162
  signing_key:
162
163
  specification_version: 3
163
164
  summary: Awesome gem for modeling your domain and storing it in mongo