use expect instead of should in specs
This commit is contained in:
parent
0be3955cd7
commit
d602b7cd0d
6 changed files with 60 additions and 60 deletions
|
|
@ -7,11 +7,11 @@ describe GroupOrderArticle do
|
|||
let(:go) { FactoryGirl.create :group_order, order: order, ordergroup: user.ordergroup }
|
||||
let(:goa) { FactoryGirl.create :group_order_article, group_order: go, order_article: order.order_articles.first }
|
||||
|
||||
it 'has zero quantity by default' do goa.quantity.should == 0 end
|
||||
it 'has zero tolerance by default' do goa.tolerance.should == 0 end
|
||||
it 'has zero result by default' do goa.result.should == 0 end
|
||||
it 'is not ordered by default' do GroupOrderArticle.ordered.where(:id => goa.id).exists?.should be_false end
|
||||
it 'has zero total price by default' do goa.total_price.should == 0 end
|
||||
it 'has zero quantity by default' do expect(goa.quantity).to eq(0) end
|
||||
it 'has zero tolerance by default' do expect(goa.tolerance).to eq(0) end
|
||||
it 'has zero result by default' do expect(goa.result).to eq(0) end
|
||||
it 'is not ordered by default' do expect(GroupOrderArticle.ordered.where(:id => goa.id).exists?).to be_false end
|
||||
it 'has zero total price by default' do expect(goa.total_price).to eq(0) end
|
||||
|
||||
describe do
|
||||
let(:article) { FactoryGirl.create :article, supplier: supplier, unit_quantity: 1 }
|
||||
|
|
@ -19,28 +19,28 @@ describe GroupOrderArticle do
|
|||
|
||||
it 'can be ordered by piece' do
|
||||
goa.update_quantities(1, 0)
|
||||
goa.quantity.should == 1
|
||||
goa.tolerance == 0
|
||||
expect(goa.quantity).to eq(1)
|
||||
expect(goa.tolerance).to eq(0)
|
||||
end
|
||||
|
||||
it 'can be ordered in larger amounts' do
|
||||
quantity, tolerance = rand(13..100), rand(0..100)
|
||||
goa.update_quantities(quantity, tolerance)
|
||||
goa.quantity.should == quantity
|
||||
goa.tolerance.should == tolerance
|
||||
expect(goa.quantity).to eq(quantity)
|
||||
expect(goa.tolerance).to eq(tolerance)
|
||||
end
|
||||
|
||||
it 'has a proper total price' do
|
||||
quantity = rand(1..100)
|
||||
goa.update_quantities(quantity, 0)
|
||||
goa.total_price.should == quantity * goa.order_article.price.fc_price
|
||||
expect(goa.total_price).to eq(quantity * goa.order_article.price.fc_price)
|
||||
end
|
||||
|
||||
it 'can unorder a product' do
|
||||
goa.update_quantities(rand(1..100), rand(0..100))
|
||||
goa.update_quantities(0, 0)
|
||||
goa.quantity.should == 0
|
||||
goa.tolerance.should == 0
|
||||
expect(goa.quantity).to eq(0)
|
||||
expect(goa.tolerance).to eq(0)
|
||||
end
|
||||
|
||||
it 'keeps track of article quantities' do
|
||||
|
|
@ -53,8 +53,8 @@ describe GroupOrderArticle do
|
|||
startt.nil? and startt = tolerance
|
||||
end
|
||||
goaq = goa.group_order_article_quantities.last
|
||||
goaq.quantity.should == startq
|
||||
goaq.tolerance.should == startt
|
||||
expect(goaq.quantity).to eq(startq)
|
||||
expect(goaq.tolerance).to eq(startt)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue