mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #10318 from dacook/10272-remove-currency-from-calculators
Remove unused currency from calculators
This commit is contained in:
@@ -7,7 +7,6 @@ module Calculator
|
||||
extend Spree::LocalizedNumber
|
||||
|
||||
preference :amount, :decimal, default: 0
|
||||
preference :currency, :string, default: Spree::Config[:currency]
|
||||
|
||||
localize_number :preferred_amount
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ module Calculator
|
||||
preference :first_item, :decimal, default: 0.0
|
||||
preference :additional_item, :decimal, default: 0.0
|
||||
preference :max_items, :integer, default: 0
|
||||
preference :currency, :string, default: Spree::Config[:currency]
|
||||
|
||||
localize_number :preferred_first_item,
|
||||
:preferred_additional_item
|
||||
|
||||
@@ -7,7 +7,6 @@ module Calculator
|
||||
extend Spree::LocalizedNumber
|
||||
|
||||
preference :amount, :decimal, default: 0
|
||||
preference :currency, :string, default: Spree::Config[:currency]
|
||||
|
||||
localize_number :preferred_amount
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ module Calculator
|
||||
preference :minimal_amount, :decimal, default: 0
|
||||
preference :normal_amount, :decimal, default: 0
|
||||
preference :discount_amount, :decimal, default: 0
|
||||
preference :currency, :string, default: Spree::Config[:currency]
|
||||
|
||||
localize_number :preferred_minimal_amount,
|
||||
:preferred_normal_amount,
|
||||
|
||||
@@ -4,7 +4,7 @@ module PermittedAttributes
|
||||
class Calculator
|
||||
def self.attributes
|
||||
[
|
||||
:id, :preferred_currency, :preferred_amount, :preferred_flat_percent,
|
||||
:id, :preferred_amount, :preferred_flat_percent,
|
||||
:preferred_minimal_amount, :preferred_normal_amount, :preferred_discount_amount,
|
||||
:preferred_unit_from_list, :preferred_per_unit, :preferred_first_item,
|
||||
:preferred_additional_item, :preferred_max_items
|
||||
|
||||
@@ -123,7 +123,6 @@ module Spree
|
||||
calculator_attributes: {
|
||||
id: payment_method.calculator.id,
|
||||
preferred_amount: 456,
|
||||
preferred_currency: "GBP"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,7 +137,6 @@ module Spree
|
||||
expect(payment_method.name).to eq "Updated"
|
||||
expect(payment_method.description).to eq "Updated"
|
||||
expect(payment_method.calculator.preferred_amount).to eq 456
|
||||
expect(payment_method.calculator.preferred_currency).to eq "GBP"
|
||||
end
|
||||
|
||||
context "when the given payment method type does not match" do
|
||||
|
||||
@@ -20,15 +20,13 @@ describe Spree::Admin::ShippingMethodsController, type: :controller do
|
||||
|
||||
before { controller_login_as_admin }
|
||||
|
||||
it "updates preferred_amount and preferred_currency of a FlatRate calculator" do
|
||||
it "updates preferred_amount of a FlatRate calculator" do
|
||||
shipping_method.calculator = create(:calculator_flat_rate, calculable: shipping_method)
|
||||
params[:shipping_method][:calculator_attributes][:preferred_amount] = 123
|
||||
params[:shipping_method][:calculator_attributes][:preferred_currency] = "EUR"
|
||||
|
||||
spree_post :update, params
|
||||
|
||||
expect(shipping_method.reload.calculator.preferred_amount).to eq 123
|
||||
expect(shipping_method.reload.calculator.preferred_currency).to eq "EUR"
|
||||
end
|
||||
|
||||
%i[
|
||||
|
||||
Reference in New Issue
Block a user