Sha256: 3ac2aa69fe83ed61ea21146f5bc7b19e4457305f80caabfecbd52ed8b62563fb
Contents?: true
Size: 1.68 KB
Versions: 5
Compression:
Stored size: 1.68 KB
Contents
# encoding: utf-8 require "spec_helper" describe Money::Constructors do describe "::empty" do it "creates a new Money object of 0 cents" do expect(Money.empty).to eq Money.new(0) end it "memoizes the result" do expect(Money.empty.object_id).to eq Money.empty.object_id end it "memoizes a result for each currency" do expect(Money.empty(:cad).object_id).to eq Money.empty(:cad).object_id end it "doesn't allow money to be modified for a currency" do expect(Money.empty).to be_frozen end end describe "::zero" do subject { Money.zero } it { is_expected.to eq Money.empty } end describe "::ca_dollar" do it "creates a new Money object of the given value in CAD" do expect(Money.ca_dollar(50)).to eq Money.new(50, "CAD") end it "is aliased to ::cad" do expect(Money.cad(50)).to eq Money.ca_dollar(50) end end describe "::us_dollar" do it "creates a new Money object of the given value in USD" do expect(Money.us_dollar(50)).to eq Money.new(50, "USD") end it "is aliased to ::usd" do expect(Money.usd(50)).to eq Money.us_dollar(50) end end describe "::euro" do it "creates a new Money object of the given value in EUR" do expect(Money.euro(50)).to eq Money.new(50, "EUR") end it "is aliased to ::eur" do expect(Money.eur(50)).to eq Money.euro(50) end end describe "::pound_sterling" do it "creates a new Money object of the given value in GBP" do expect(Money.pound_sterling(50)).to eq Money.new(50, "GBP") end it "is aliased to ::gbp" do expect(Money.gbp(50)).to eq Money.pound_sterling(50) end end end
Version data entries
5 entries across 5 versions & 2 rubygems