Skip to content

Commit

Permalink
Fix checkout feature specs
Browse files Browse the repository at this point in the history
  • Loading branch information
HugsDaniel committed Nov 22, 2018
1 parent 733a018 commit 42d2599
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/spree/orders_controller_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def edit
associate_user

if @order.insufficient_stock_lines.present?
flash[:error] = t(:spree_inventory_error_flash_for_insufficient_quantity)
flash[:error] = t("spree.inventory_error_flash_for_insufficient_quantity")
end
end
end
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2659,6 +2659,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
my_account: "My account"
date: "Date"
time: "Time"
inventory_error_flash_for_insufficient_quantity: "An item in your cart has become unavailable"
layouts:
admin:
header:
Expand Down
6 changes: 4 additions & 2 deletions spec/features/consumer/shopping/checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let(:enterprise_fee) { create(:enterprise_fee, amount: 1.23, tax_category: product.tax_category) }
let(:product) { create(:taxed_product, supplier: supplier, price: 10, zone: zone, tax_rate_amount: 0.1) }
let(:variant) { product.variants.first }
let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor) }
let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor, bill_address_id: nil, ship_address_id: nil) }

before do
Spree::Config.shipment_inc_vat = true
Expand Down Expand Up @@ -47,6 +47,7 @@

describe "when I have an out of stock product in my cart" do
before do
variant.on_demand = false
variant.on_hand = 0
variant.save!
end
Expand Down Expand Up @@ -411,14 +412,15 @@ def fill_out_form
end

it "takes us to the cart page with an error when a product becomes out of stock just before we purchase", js: true do
variant.on_demand = false
variant.on_hand = 0
variant.save!

place_order

page.should_not have_content "Your order has been processed successfully"
page.should have_selector 'closing', text: "Your shopping cart"
page.should have_content "Out of Stock"
page.should have_content "Out Of Stock"
end

context "when we are charged a shipping fee" do
Expand Down

0 comments on commit 42d2599

Please sign in to comment.