spec/mongomodel/concerns/associations/belongs_to_spec.rb in mongomodel-0.1.5 vs spec/mongomodel/concerns/associations/belongs_to_spec.rb in mongomodel-0.1.6
- old
+ new
@@ -18,10 +18,14 @@
it "should be settable" do
subject.user = user
subject.user.should == user
end
+ it "should not be truthy" do
+ subject.user.should_not be_truthy
+ end
+
describe "setting a subclass type" do
it "should set successfully" do
subject.user = special_user
subject.user.should == special_user
end
@@ -45,15 +49,19 @@
it "should access the user through the association" do
reloaded.user.should == user
end
+ it "should be truthy" do
+ subject.user.should be_truthy
+ end
+
it "should allow the user to be reloaded" do
- reloaded.user.inspect
- reloaded.user.loaded?.should be_true
+ user = reloaded.user.target
- reloaded.user(true)
- reloaded.user.loaded?.should be_false
+ user.should equal(reloaded.user.target)
+ user.should equal(reloaded.user.target)
+ user.should_not equal(reloaded.user(true).target)
end
describe "setting a subclass type" do
subject { Article.new(:user => special_user) }