Sha256: fecb61d941535a9393ac903d1e9fdd437019bf91e0330313f9fd09ca41409175

Contents?: true

Size: 1.89 KB

Versions: 3

Compression:

Stored size: 1.89 KB

Contents

require 'spec_helper'

describe 'MoneyRails::ActionViewExtension' do
  describe '#currency_symbol' do
    subject { helper.currency_symbol }
    it { should be_a String }
    it { should include Money.default_currency.symbol }
  end

  describe '#humanized_money' do
    let(:options) { {} }
    subject { helper.humanized_money Money.new(12500), options }
    it { should be_a String }
    it { should_not include Money.default_currency.symbol }
    it { should_not include Money.default_currency.decimal_mark }

    context 'with symbol options' do
      let(:options) { { :symbol => true } }
      it { should include Money.default_currency.symbol }
    end

    context 'with deprecated symbol' do
      let(:options) { true }
      before(:each) do
        helper.should_receive(:warn)
      end
      it { should include Money.default_currency.symbol }
    end
  end

  describe '#humanized_money_with_symbol' do
    subject { helper.humanized_money_with_symbol Money.new(12500) }
    it { should be_a String }
    it { should_not include Money.default_currency.decimal_mark }
    it { should include Money.default_currency.symbol }
  end

  describe '#money_without_cents' do
    let(:options) { {} }
    subject { helper.money_without_cents Money.new(12500), options }
    it { should be_a String }
    it { should_not include Money.default_currency.symbol }
    it { should_not include Money.default_currency.decimal_mark }

    context 'with deprecated symbol' do
      let(:options) { true }
      before(:each) do
        helper.should_receive(:warn)
      end
      it { should include Money.default_currency.symbol }
    end
  end

  describe '#money_without_cents_and_with_symbol' do
    subject { helper.money_without_cents_and_with_symbol Money.new(12500) }
    it { should be_a String }
    it { should_not include Money.default_currency.decimal_mark }
    it { should include Money.default_currency.symbol }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
money-rails-0.10.0 spec/helpers/action_view_extension_spec.rb
money-rails-0.9.0 spec/helpers/action_view_extension_spec.rb
money-rails-0.8.1 spec/helpers/action_view_extension_spec.rb