Remove typo in specs. (thanks Brian Colfer for spotting it)

Signed-off-by: Marcos Tapajós <tapajos@gmail.com>
This commit is contained in:
Will Leinweber 2010-08-13 20:16:56 -05:00 committed by Marcos Tapajós
parent 9437678380
commit b20bfad11f

View file

@ -8,7 +8,7 @@ describe "Assocations" do
describe "of type belongs to" do describe "of type belongs to" do
before :each do before :each do
@invoice = SaleInvoice.create(:price => "sam", :price => 2000) @invoice = SaleInvoice.create(:price => 2000)
@client = Client.create(:name => "Sam Lown") @client = Client.create(:name => "Sam Lown")
end end
@ -69,7 +69,7 @@ describe "Assocations" do
describe "of type collection_of" do describe "of type collection_of" do
before(:each) do before(:each) do
@invoice = SaleInvoice.create(:price => "sam", :price => 2000) @invoice = SaleInvoice.create(:price => 2000)
@entries = [ @entries = [
SaleEntry.create(:description => 'test line 1', :price => 500), SaleEntry.create(:description => 'test line 1', :price => 500),
SaleEntry.create(:description => 'test line 2', :price => 500), SaleEntry.create(:description => 'test line 2', :price => 500),
@ -96,7 +96,7 @@ describe "Assocations" do
@invoice.entries.length.should eql(3) @invoice.entries.length.should eql(3)
@invoice.entries.first.should eql(@entries.first) @invoice.entries.first.should eql(@entries.first)
end end
it "should replace collection if ids replaced" do it "should replace collection if ids replaced" do
@invoice.entry_ids = @entries.collect{|i| i.id} @invoice.entry_ids = @entries.collect{|i| i.id}
@invoice.entries.length.should eql(3) # load once @invoice.entries.length.should eql(3) # load once
@ -110,7 +110,7 @@ describe "Assocations" do
@invoice.entry_ids << @entries[2].id @invoice.entry_ids << @entries[2].id
@invoice.entry_ids.length.should eql(3) @invoice.entry_ids.length.should eql(3)
@invoice.entries.length.should eql(2) # cached! @invoice.entries.length.should eql(2) # cached!
@invoice.entries(true).length.should eql(3) @invoice.entries(true).length.should eql(3)
end end
it "should empty arrays when nil collection provided" do it "should empty arrays when nil collection provided" do
@ -134,7 +134,7 @@ describe "Assocations" do
end end
describe "proxy" do describe "proxy" do
it "should ensure new entries to proxy are matched" do it "should ensure new entries to proxy are matched" do
@invoice.entries << @entries.first @invoice.entries << @entries.first
@invoice.entry_ids.first.should eql(@entries.first.id) @invoice.entry_ids.first.should eql(@entries.first.id)
@ -177,7 +177,7 @@ describe "Assocations" do
@invoice.entries.first.should eql(@entries[1]) @invoice.entries.first.should eql(@entries[1])
@invoice.entry_ids.first.should eql(@entries[1].id) @invoice.entry_ids.first.should eql(@entries[1].id)
end end
it "should raise error when adding un-persisted entries" do it "should raise error when adding un-persisted entries" do
SaleEntry.find_by_description('test entry').should be_nil SaleEntry.find_by_description('test entry').should be_nil
entry = SaleEntry.new(:description => 'test entry', :price => 500) entry = SaleEntry.new(:description => 'test entry', :price => 500)