fix linting errors

This commit is contained in:
Mohamed ABDELLANI
2023-07-15 09:47:41 +01:00
parent 4a74396bcc
commit 7cb200e21e
3 changed files with 7 additions and 9 deletions

View File

@@ -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
end

View File

@@ -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

View File

@@ -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