diff --git a/spec/models/budget_spec.rb b/spec/models/budget_spec.rb index 80f0a0c94..72b521861 100644 --- a/spec/models/budget_spec.rb +++ b/spec/models/budget_spec.rb @@ -228,4 +228,38 @@ describe Budget do expect(finished_phase.prev_phase).to eq(reviewing_ballots_phase) end end + + describe "#formatted_amount" do + after do + I18n.locale = :en + end + + it "correctly formats Euros with Spanish" do + budget.update(currency_symbol: '€') + I18n.locale = :es + + expect(budget.formatted_amount(1000.00)).to eq ('1.000 €') + end + + it "correctly formats Dollars with Spanish" do + budget.update(currency_symbol: '$') + I18n.locale = :es + + expect(budget.formatted_amount(1000.00)).to eq ('1.000 $') + end + + it "correctly formats Dollars with English" do + budget.update(currency_symbol: '$') + I18n.locale = :en + + expect(budget.formatted_amount(1000.00)).to eq ('$1,000') + end + + it "correctly formats Euros with English" do + budget.update(currency_symbol: '€') + I18n.locale = :en + + expect(budget.formatted_amount(1000.00)).to eq ('€1,000') + end + end end