use expect instead of should in specs

This commit is contained in:
wvengen 2013-07-24 22:46:25 +02:00
parent 0be3955cd7
commit d602b7cd0d
6 changed files with 60 additions and 60 deletions

View file

@ -6,39 +6,39 @@ describe Article do
it 'has a unique name' do
article2 = FactoryGirl.build :article, supplier: supplier, name: article.name
article2.should_not be_valid
expect(article2).to be_invalid
end
it 'computes the gross price correctly' do
article.deposit = 0
article.tax = 12
article.gross_price.should == (article.price * 1.12).round(2)
expect(article.gross_price).to eq((article.price * 1.12).round(2))
article.deposit = 1.20
article.gross_price.should == ((article.price + 1.20) * 1.12).round(2)
expect(article.gross_price).to eq(((article.price + 1.20) * 1.12).round(2))
end
it 'gross price >= net price' do
article.gross_price.should >= article.price
expect(article.gross_price).to be >= article.price
end
it 'fc-price > gross price' do
article.fc_price.should > article.gross_price
expect(article.fc_price).to be > article.gross_price
end
it 'knows when it is deleted' do
supplier.deleted?.should be_false
expect(supplier.deleted?).to be_false
supplier.mark_as_deleted
supplier.deleted?.should be_true
expect(supplier.deleted?).to be_true
end
it 'keeps a price history' do
article.article_prices.count.should == 1
expect(article.article_prices.count).to eq(1)
oldprice = article.price
article.price += 1
article.save!
article.article_prices.count.should == 2
article.article_prices[0].price.should == article.price
article.article_prices[-1].price.should == oldprice
expect(article.article_prices.count).to eq(2)
expect(article.article_prices[0].price).to eq(article.price)
expect(article.article_prices[-1].price).to eq(oldprice)
end
end