From db06f7b49ce30744efc7e96781212b4cdb41ce39 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Wed, 29 Nov 2023 18:33:37 +0100 Subject: [PATCH] Expose the amount percentage for tax rates --- core/app/models/spree/tax_rate.rb | 4 ++++ core/spec/models/spree/tax_rate_spec.rb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/core/app/models/spree/tax_rate.rb b/core/app/models/spree/tax_rate.rb index 8cec5e00fa7..39b6ef8aaab 100644 --- a/core/app/models/spree/tax_rate.rb +++ b/core/app/models/spree/tax_rate.rb @@ -113,6 +113,10 @@ def adjustment_label(amount) ) end + def display_amount + amount_for_adjustment_label + end + private def amount_for_adjustment_label diff --git a/core/spec/models/spree/tax_rate_spec.rb b/core/spec/models/spree/tax_rate_spec.rb index 24b1e0f0908..c9550b2f633 100644 --- a/core/spec/models/spree/tax_rate_spec.rb +++ b/core/spec/models/spree/tax_rate_spec.rb @@ -256,4 +256,10 @@ end end end + + describe "#display_amount" do + subject(:rate) { create(:tax_rate, amount: 0.1).display_amount } + + it { is_expected.to eq("10.0%") } + end end