Run transpec

This commit is contained in:
Luis Ramos
2020-08-07 21:42:17 +01:00
parent e9f76cb339
commit d4e4669e49
2 changed files with 8 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ module Spree
context '#duplicate' do
before do
product.stub taxons: [create(:taxon)]
allow(product).to receive_messages taxons: [create(:taxon)]
end
it 'duplicates product' do
@@ -238,7 +238,7 @@ module Spree
describe '#total_on_hand' do
it 'returns sum of stock items count_on_hand' do
product = build(:product)
product.stub stock_items: [double(Spree::StockItem, count_on_hand: 5)]
allow(product).to receive_messages stock_items: [double(Spree::StockItem, count_on_hand: 5)]
expect(product.total_on_hand).to eql(5)
end
end

View File

@@ -218,12 +218,12 @@ module Spree
describe '#in_stock?' do
context 'when stock_items are not backorderable' do
before do
Spree::StockItem.any_instance.stub(backorderable: false)
allow_any_instance_of(Spree::StockItem).to receive_messages(backorderable: false)
end
context 'when stock_items in stock' do
before do
Spree::StockItem.any_instance.stub(count_on_hand: 10)
allow_any_instance_of(Spree::StockItem).to receive_messages(count_on_hand: 10)
end
it 'returns true if stock_items in stock' do
@@ -233,8 +233,8 @@ module Spree
context 'when stock_items out of stock' do
before do
Spree::StockItem.any_instance.stub(backorderable: false)
Spree::StockItem.any_instance.stub(count_on_hand: 0)
allow_any_instance_of(Spree::StockItem).to receive_messages(backorderable: false)
allow_any_instance_of(Spree::StockItem).to receive_messages(count_on_hand: 0)
end
it 'return false if stock_items out of stock' do
@@ -258,12 +258,12 @@ module Spree
context 'when stock_items are backorderable' do
before do
Spree::StockItem.any_instance.stub(backorderable?: true)
allow_any_instance_of(Spree::StockItem).to receive_messages(backorderable?: true)
end
context 'when stock_items out of stock' do
before do
Spree::StockItem.any_instance.stub(count_on_hand: 0)
allow_any_instance_of(Spree::StockItem).to receive_messages(count_on_hand: 0)
end
it 'returns true if stock_items in stock' do