Add Budget#formatted_amount unit test
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user