mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
Run transpec
This commit is contained in:
@@ -13,24 +13,24 @@ describe Spree::Money do
|
||||
|
||||
it "formats correctly" do
|
||||
money = Spree::Money.new(10)
|
||||
money.to_s.should == "$10.00"
|
||||
expect(money.to_s).to eq("$10.00")
|
||||
end
|
||||
|
||||
it "can get cents" do
|
||||
money = Spree::Money.new(10)
|
||||
money.cents.should == 1000
|
||||
expect(money.cents).to eq(1000)
|
||||
end
|
||||
|
||||
context "with currency" do
|
||||
it "passed in option" do
|
||||
money = Spree::Money.new(10, with_currency: true, html: false)
|
||||
money.to_s.should == "$10.00 USD"
|
||||
expect(money.to_s).to eq("$10.00 USD")
|
||||
end
|
||||
|
||||
it "config option" do
|
||||
Spree::Config[:display_currency] = true
|
||||
money = Spree::Money.new(10, html: false)
|
||||
money.to_s.should == "$10.00 USD"
|
||||
expect(money.to_s).to eq("$10.00 USD")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,13 +38,13 @@ describe Spree::Money do
|
||||
it "hides cents suffix" do
|
||||
Spree::Config[:hide_cents] = true
|
||||
money = Spree::Money.new(10)
|
||||
money.to_s.should == "$10"
|
||||
expect(money.to_s).to eq("$10")
|
||||
end
|
||||
|
||||
it "shows cents suffix" do
|
||||
Spree::Config[:hide_cents] = false
|
||||
money = Spree::Money.new(10)
|
||||
money.to_s.should == "$10.00"
|
||||
expect(money.to_s).to eq("$10.00")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,14 +52,14 @@ describe Spree::Money do
|
||||
context "when currency is specified in Canadian Dollars" do
|
||||
it "uses the currency param over the global configuration" do
|
||||
money = Spree::Money.new(10, currency: 'CAD', with_currency: true, html: false)
|
||||
money.to_s.should == "$10.00 CAD"
|
||||
expect(money.to_s).to eq("$10.00 CAD")
|
||||
end
|
||||
end
|
||||
|
||||
context "when currency is specified in Japanese Yen" do
|
||||
it "uses the currency param over the global configuration" do
|
||||
money = Spree::Money.new(100, currency: 'JPY', html: false)
|
||||
money.to_s.should == "¥100"
|
||||
expect(money.to_s).to eq("¥100")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -67,18 +67,18 @@ describe Spree::Money do
|
||||
context "symbol positioning" do
|
||||
it "passed in option" do
|
||||
money = Spree::Money.new(10, symbol_position: :after, html: false)
|
||||
money.to_s.should == "10.00 $"
|
||||
expect(money.to_s).to eq("10.00 $")
|
||||
end
|
||||
|
||||
it "passed in option string" do
|
||||
money = Spree::Money.new(10, symbol_position: "after", html: false)
|
||||
money.to_s.should == "10.00 $"
|
||||
expect(money.to_s).to eq("10.00 $")
|
||||
end
|
||||
|
||||
it "config option" do
|
||||
Spree::Config[:currency_symbol_position] = :after
|
||||
money = Spree::Money.new(10, html: false)
|
||||
money.to_s.should == "10.00 $"
|
||||
expect(money.to_s).to eq("10.00 $")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,7 +93,7 @@ describe Spree::Money do
|
||||
|
||||
it "formats correctly" do
|
||||
money = Spree::Money.new(1000, html: false)
|
||||
money.to_s.should == "¥1,000"
|
||||
expect(money.to_s).to eq("¥1,000")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -106,30 +106,30 @@ describe Spree::Money do
|
||||
end
|
||||
end
|
||||
|
||||
# Regression test for #2634
|
||||
# Regression test for Spree #2634
|
||||
it "formats as plain by default" do
|
||||
money = Spree::Money.new(10)
|
||||
money.to_s.should == "10.00 €"
|
||||
expect(money.to_s).to eq("10.00 €")
|
||||
end
|
||||
|
||||
# Regression test for #2632
|
||||
# Regression test for Spree #2632
|
||||
it "acknowledges decimal mark option" do
|
||||
Spree::Config[:currency_decimal_mark] = ","
|
||||
money = Spree::Money.new(10)
|
||||
money.to_s.should == "10,00 €"
|
||||
expect(money.to_s).to eq("10,00 €")
|
||||
end
|
||||
|
||||
# Regression test for #2632
|
||||
# Regression test for Spree #2632
|
||||
it "acknowledges thousands separator option" do
|
||||
Spree::Config[:currency_thousands_separator] = "."
|
||||
money = Spree::Money.new(1000)
|
||||
money.to_s.should == "1.000.00 €"
|
||||
expect(money.to_s).to eq("1.000.00 €")
|
||||
end
|
||||
|
||||
it "formats as HTML if asked (nicely) to" do
|
||||
money = Spree::Money.new(10)
|
||||
# The HTMLified version of the euro sign
|
||||
money.to_html.should == "10.00 €"
|
||||
expect(money.to_html).to eq("10.00 €")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user