Skip to content

Commit

Permalink
Fix failing feature specs
Browse files Browse the repository at this point in the history
  • Loading branch information
kushniryb authored and damianlegawiec committed Feb 9, 2019
1 parent b79eafa commit 2df551f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -20,7 +20,7 @@ $(document).ready(function () {
function addVariant () {
$('#stock_details').hide()
var variantId = $('input.variant_autocomplete').val()
var quantity = $("input.quantity[data-variant-id='" + variantId + "']").val()
var quantity = $('input#variant_quantity').val()

adjustLineItems(order_number, variantId, quantity)
return 1
Expand Down
10 changes: 6 additions & 4 deletions backend/spec/features/admin/orders/order_details_spec.rb
Expand Up @@ -211,13 +211,15 @@
end

context 'variant out of stock and not backorderable' do
let(:tote) { create(:product, name: 'Tote', price: 15.00) }

before do
product.master.stock_items.first.update_column(:backorderable, false)
product.master.stock_items.first.update_column(:count_on_hand, 0)
tote.master.stock_items.first.update(backorderable: false)
tote.master.stock_items.first.update(count_on_hand: 0)
end

it 'displays out of stock instead of add button' do
select2_search product.name, from: Spree.t(:name_or_sku)
it 'does not add a product to the order' do
select2_search tote.name, from: Spree.t(:name_or_sku)

within('table.stock-levels') do
expect(page).to have_content(Spree.t(:out_of_stock))
Expand Down

0 comments on commit 2df551f

Please sign in to comment.