Add additional model and integration tests
This commit adds new tests for a better coverage. integration/ * home * supplier models/ * article * delivery * group_order_article * supplier also adds a new factory for delivery Co-authored-by: viehlieb <pf@pragma-shift.net> Co-authored-by: Tobias Kneuker <tk@pragma-shift.net>
This commit is contained in:
parent
9a46640d3b
commit
c6560e0cea
8 changed files with 167 additions and 7 deletions
23
spec/models/delivery_spec.rb
Normal file
23
spec/models/delivery_spec.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
require_relative '../spec_helper'
|
||||
|
||||
describe Delivery do
|
||||
let(:delivery) { create :delivery }
|
||||
let(:stock_article) { create :stock_article, price: 3 }
|
||||
|
||||
it 'creates new stock_changes' do
|
||||
delivery.new_stock_changes = ([
|
||||
{
|
||||
quantity: 1,
|
||||
stock_article: stock_article
|
||||
},
|
||||
{
|
||||
quantity: 2,
|
||||
stock_article: stock_article
|
||||
}
|
||||
])
|
||||
|
||||
expect(delivery.stock_changes.last[:stock_article_id]).to be stock_article.id
|
||||
expect(delivery.includes_article?(stock_article)).to be true
|
||||
expect(delivery.sum(:net)).to eq 9
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue