Sha256: 791397601043692468c30dccc580b7f3382c734d3e9bf99ad5093fb032482436
Contents?: true
Size: 957 Bytes
Versions: 1
Compression:
Stored size: 957 Bytes
Contents
require File.dirname(__FILE__) + '/spec_helper' describe 'belongs_to' do before(:each) do @commenter = Commenter.create! end it "should return nil by default" do c = Comment.new :title => 'title' c.commenter.should be_nil c.commenter_id.should be_nil end it "should assign the parent object" do c = Comment.new :title => 'title' c.commenter = @commenter c.commenter.should == @commenter c.commenter_id.should == @commenter.id end it "should assign the parent object id" do c = Comment.new :title => 'title' c.commenter_id = @commenter.id c.commenter.should == @commenter c.commenter_id.should == @commenter.id end it "should persist the link to the parent object" do c = Comment.new :title => 'title' c.commenter_id = @commenter.id c.save! c = Comment.find c.id c.commenter._id.should == @commenter.id c.commenter_id.should == @commenter._id end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
langalex-couch_potato-0.1 | spec/belongs_to_spec.rb |