mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Replace deprecated reloading by passing true to an association
object.relation(true) -> object.relation.reload
This commit is contained in:
@@ -233,7 +233,7 @@ feature '
|
||||
expect(current_path).to eq main_app.admin_enterprise_producer_properties_path(s)
|
||||
|
||||
# And the producer should have the property
|
||||
expect(s.producer_properties(true).count).to eq(1)
|
||||
expect(s.producer_properties.reload.count).to eq(1)
|
||||
expect(s.producer_properties.first.property.presentation).to eq("Certified Organic")
|
||||
expect(s.producer_properties.first.value).to eq("NASAA 12345")
|
||||
end
|
||||
@@ -255,7 +255,7 @@ feature '
|
||||
expect(current_path).to eq main_app.admin_enterprise_producer_properties_path(s)
|
||||
|
||||
# And the property should be updated
|
||||
expect(s.producer_properties(true).count).to eq(1)
|
||||
expect(s.producer_properties.reload.count).to eq(1)
|
||||
expect(s.producer_properties.first.property.presentation).to eq("Biodynamic")
|
||||
expect(s.producer_properties.first.value).to eq("Shininess")
|
||||
end
|
||||
@@ -276,7 +276,7 @@ feature '
|
||||
# Then the property should have been removed
|
||||
expect(current_path).to eq main_app.admin_enterprise_producer_properties_path(s)
|
||||
expect(page).not_to have_field 'enterprise_producer_properties_attributes_0_property_name', with: 'Certified Organic'
|
||||
expect(s.producer_properties(true)).to be_empty
|
||||
expect(s.producer_properties.reload).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -418,7 +418,7 @@ feature '
|
||||
page.evaluate_script("angular.element(enterprise_form).scope().setFormDirty()")
|
||||
click_button 'Update'
|
||||
|
||||
expect(supplier1.producer_properties(true).count).to eq(1)
|
||||
expect(supplier1.producer_properties.reload.count).to eq(1)
|
||||
|
||||
# -- Destroy
|
||||
pp = supplier1.producer_properties.first
|
||||
@@ -436,7 +436,7 @@ feature '
|
||||
click_button 'Update'
|
||||
|
||||
expect(page).to have_content 'Enterprise "First Supplier" has been successfully updated!'
|
||||
expect(supplier1.producer_properties(true)).to be_empty
|
||||
expect(supplier1.producer_properties.reload).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -85,7 +85,7 @@ feature '
|
||||
find('button.add_variant').click
|
||||
|
||||
expect(page).to have_selector 'td', text: product.name
|
||||
expect(order.line_items(true).map(&:product)).to include product
|
||||
expect(order.line_items.reload.map(&:product)).to include product
|
||||
end
|
||||
|
||||
scenario "displays error when incorrect distribution for products is chosen" do
|
||||
|
||||
@@ -159,7 +159,7 @@ feature "full-page cart", js: true do
|
||||
end
|
||||
|
||||
describe "updating quantities" do
|
||||
let(:li) { order.line_items(true).last }
|
||||
let(:li) { order.line_items.reload.last }
|
||||
let(:variant) { product_with_tax.variants.first }
|
||||
let(:variant2) { product_with_fee.variants.first }
|
||||
|
||||
|
||||
@@ -783,7 +783,7 @@ module Spree
|
||||
expect(v.option_values.map(&:name).include?("1g")).to eq(true)
|
||||
expect {
|
||||
p.update!(variant_unit: 'volume', variant_unit_scale: 0.001)
|
||||
}.to change(p.master.option_values(true), :count).by(0)
|
||||
}.to change(p.master.option_values.reload, :count).by(0)
|
||||
v.reload
|
||||
expect(v.option_values.map(&:name).include?("1L")).to eq(true)
|
||||
expect(v.option_values.map(&:name).include?("1g")).to eq(false)
|
||||
@@ -798,7 +798,7 @@ module Spree
|
||||
expect(p.master.option_values.map(&:name).include?("1g")).to eq(true)
|
||||
expect {
|
||||
p.update!(variant_unit: 'volume', variant_unit_scale: 0.001)
|
||||
}.to change(p.master.option_values(true), :count).by(0)
|
||||
}.to change(p.master.option_values.reload, :count).by(0)
|
||||
p.reload
|
||||
expect(p.master.option_values.map(&:name).include?("1L")).to eq(true)
|
||||
expect(p.master.option_values.map(&:name).include?("1g")).to eq(false)
|
||||
@@ -835,8 +835,8 @@ module Spree
|
||||
p.option_type_ids = p.option_type_ids.reject { |id| id == ot.id }
|
||||
|
||||
# Then the associated option values should have been removed from the variants
|
||||
expect(v1.option_values(true)).not_to include ov1
|
||||
expect(v2.option_values(true)).not_to include ov2
|
||||
expect(v1.option_values.reload).not_to include ov1
|
||||
expect(v2.option_values.reload).not_to include ov2
|
||||
|
||||
# And the option values themselves should still exist
|
||||
expect(Spree::OptionValue.where(id: [ov1.id, ov2.id]).count).to eq(2)
|
||||
@@ -864,13 +864,13 @@ module Spree
|
||||
it "removes the master variant from all order cycles" do
|
||||
e.variants << p.master
|
||||
p.destroy
|
||||
expect(e.variants(true)).to be_empty
|
||||
expect(e.variants.reload).to be_empty
|
||||
end
|
||||
|
||||
it "removes all other variants from order cycles" do
|
||||
e.variants << v
|
||||
p.destroy
|
||||
expect(e.variants(true)).to be_empty
|
||||
expect(e.variants.reload).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user