Sha256: 210ac936b052c327a520db092cb058ec3989ce6c548c0a1bbd086f84dbc42dd5

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

require 'spec_helper'

RSpec.shared_examples_for "an object supporting to_money" do
  it "supports to_money" do
    expect(@value.to_money).to eq(@money)
    expect(@value.to_money('CAD').currency).to eq(Money::Currency.find!('CAD'))
  end
end

RSpec.describe Integer do
  before(:each) do
    @value = 1
    @money = Money.new("1.00")
  end

  it_should_behave_like "an object supporting to_money"
end

RSpec.describe Float do
  before(:each) do
    @value = 1.23
    @money = Money.new("1.23")
  end

  it_should_behave_like "an object supporting to_money"
end

RSpec.describe String do
  before(:each) do
    @value = "1.23"
    @money = Money.new(@value)
  end

  it_should_behave_like "an object supporting to_money"
end

RSpec.describe BigDecimal do
  before(:each) do
    @value = BigDecimal.new("1.23")
    @money = Money.new("1.23")
  end

  it_should_behave_like "an object supporting to_money"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shopify-money-0.10.0 spec/core_extensions_spec.rb