diff --git a/app/models/invoice/data_presenter/adjustable.rb b/app/models/invoice/data_presenter/adjustable.rb index 299732d77f..da8f4ad7b3 100644 --- a/app/models/invoice/data_presenter/adjustable.rb +++ b/app/models/invoice/data_presenter/adjustable.rb @@ -2,20 +2,19 @@ class Invoice class DataPresenter - class Adjustable < Invoice::DataPresenter::Base + class Adjustable < Invoice::DataPresenter::Base attributes :id, :type, :currency, :included_tax_total, :additional_tax_total, :amount def display_taxes(display_zero: false) if included_tax_total.positive? - amount = Spree::Money.new(included_tax_total, currency: currency) - I18n.t(:tax_amount_included, amount: amount) + amount = Spree::Money.new(included_tax_total, currency:) + I18n.t(:tax_amount_included, amount:) elsif additional_tax_total.positive? - Spree::Money.new(additional_tax_total, currency: currency) + Spree::Money.new(additional_tax_total, currency:) elsif display_zero - Spree::Money.new(0.00, currency: currency) + Spree::Money.new(0.00, currency:) end end - end end -end \ No newline at end of file +end diff --git a/app/models/invoice/data_presenter_attributes.rb b/app/models/invoice/data_presenter_attributes.rb index bc2b3b7c75..0609549cba 100644 --- a/app/models/invoice/data_presenter_attributes.rb +++ b/app/models/invoice/data_presenter_attributes.rb @@ -20,7 +20,7 @@ class Invoice instance_variable_set("@#{attribute}", Invoice::DataPresenter.const_get( - class_name.present? ? class_name : attribute.to_s.classify + class_name.presence || attribute.to_s.classify ).new(data&.[](attribute))) end end diff --git a/spec/system/admin/invoice_print_spec.rb b/spec/system/admin/invoice_print_spec.rb index eea468e046..f323eee21a 100644 --- a/spec/system/admin/invoice_print_spec.rb +++ b/spec/system/admin/invoice_print_spec.rb @@ -122,7 +122,6 @@ describe ' expect(page).to have_content 'description2' end end - end shared_examples "Check display on each invoice: legacy and alternative" do |alternative_invoice| let!(:completed_order) do