uses FactoryGirl helpers
This commit is contained in:
parent
1cf2145ff6
commit
f462e70e49
17 changed files with 65 additions and 63 deletions
|
|
@ -1,10 +1,10 @@
|
|||
require 'spec_helper'
|
||||
require_relative '../spec_helper'
|
||||
|
||||
describe GroupOrderArticle do
|
||||
let(:user) { FactoryGirl.create :user, groups: [FactoryGirl.create(:ordergroup)] }
|
||||
let(:order) { FactoryGirl.create(:order).reload }
|
||||
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 }
|
||||
let(:user) { create :user, groups: [create(:ordergroup)] }
|
||||
let(:order) { create(:order) }
|
||||
let(:go) { create :group_order, order: order, ordergroup: user.ordergroup }
|
||||
let(:goa) { create :group_order_article, group_order: go, order_article: order.order_articles.first }
|
||||
|
||||
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
|
||||
|
|
@ -13,9 +13,9 @@ describe GroupOrderArticle do
|
|||
it 'has zero total price by default' do expect(goa.total_price).to eq(0) end
|
||||
|
||||
describe do
|
||||
let(:article) { FactoryGirl.create :article, supplier: order.supplier, unit_quantity: 1 }
|
||||
let(:article) { create :article, supplier: order.supplier, unit_quantity: 1 }
|
||||
let(:oa) { order.order_articles.create(:article => article) }
|
||||
let(:goa) { FactoryGirl.create :group_order_article, group_order: go, order_article: oa }
|
||||
let(:goa) { create :group_order_article, group_order: go, order_article: oa }
|
||||
|
||||
it 'can be ordered by piece' do
|
||||
goa.update_quantities(1, 0)
|
||||
|
|
@ -42,7 +42,6 @@ describe GroupOrderArticle do
|
|||
expect(goa.quantity).to eq(0)
|
||||
expect(goa.tolerance).to eq(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue