mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Test to reproduce bug with overridden price not being displayed when an order is added manually
This commit is contained in:
@@ -71,6 +71,14 @@ FactoryGirl.define do
|
||||
end
|
||||
end
|
||||
|
||||
factory :order_cycle_with_overrides, parent: :order_cycle do
|
||||
after (:create) do |oc|
|
||||
oc.variants.each do |variant|
|
||||
create(:variant_override, variant: variant, hub: oc.coordinator, price: variant.price + 100)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
factory :simple_order_cycle, :class => OrderCycle do
|
||||
sequence(:name) { |n| "Order Cycle #{n}" }
|
||||
|
||||
|
||||
@@ -315,6 +315,29 @@ feature %q{
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "when manually placing an order" do
|
||||
let!(:order_cycle) { create(:order_cycle_with_overrides, name: "Overidden") }
|
||||
|
||||
before do
|
||||
dist = order_cycle.distributors.first
|
||||
login_to_admin_section
|
||||
visit 'admin/orders/new'
|
||||
select2_select dist.name, from: 'order_distributor_id'
|
||||
page.should have_select2 'order_order_cycle_id', with_options: ['Overidden (open)']
|
||||
select2_select order_cycle.name, from: 'order_order_cycle_id'
|
||||
end
|
||||
|
||||
# Reproducing a bug, issue #1446
|
||||
it "shows the overridden price" do
|
||||
product = order_cycle.products.first
|
||||
targetted_select2_search product.name, from: '#add_variant_id', dropdown_css: '.select2-drop'
|
||||
click_link 'Add'
|
||||
page.has_selector? "table.index tbody[data-hook='admin_order_form_line_items'] tr" # Wait for JS
|
||||
page.should have_content product.variants.first.variant_overrides.first.price
|
||||
end
|
||||
end
|
||||
|
||||
describe "when inventory_items do not exist for variants" do
|
||||
|
||||
Reference in New Issue
Block a user