0
我有一個rspec文件,它看起來像缺少兩個「結束」,但當我把這些結束時,我的測試引發錯誤「意外結束」...這裏的文件:rspec文件丟失結束,但拋出錯誤,當我有它
require File.dirname(__FILE__) + '/../spec_helper'
describe Invoice do
describe 'creation' do
before(:each) do
@invoice = FactoryGirl.build(:invoice)
end
it 'is invalid without a user' do
invoice = @invoice
invoice.user = nil
invoice.should_not be_valid
end
it 'is invalid without a client' do
invoice = @invoice
invoice.client = nil
invoice.should_not be_valid
end
it 'is invalid without a public_id' do
invoice = @invoice
invoice.public_id = nil
invoice.should_not be_valid
end
it 'is invalid without a payment_term' do
invoice = @invoice
invoice.payment_term = nil
invoice.should_not be_valid
end
it 'is invalid without an issue_date' do
invoice = @invoice
invoice.issue_date = nil
invoice.should_not be_valid
end
it 'is invalid without a client_invoice_id' do
invoice = @invoice
invoice.client_invoice_id = nil
invoice.should_not be_valid
end
end
describe 'method has_payment_date?' do
it "should return true when payment_term is not 'None'"
@invoice = FactoryGirl.build(:invoice)
@invoice.payment_term = "Net 15"
@invoice.has_payment_date?.should == true
end
it "should return false when payment_term is 'None'"
@invoice = FactoryGirl.build(:invoice)
@invoice.payment_term = "Net 15"
@invoice.has_payment_date?.should == true
end
現在看來,上面的代碼缺少兩個「結束」秒,但它傳遞的時候是這樣的,並引發當我把端回一個錯誤。我錯過了什麼?
你錯過了最後兩個'it'的結尾'do' – house9