Sha256: 3820037704f493d49805d71002f32eb44581edcb977c5bdcb268969db17ef672

Contents?: true

Size: 657 Bytes

Versions: 54

Compression:

Stored size: 657 Bytes

Contents

require 'spec_helper'

describe EffectiveOrdersHelper do
  describe '#price_to_currency' do
    it 'converts an integer number of cents to a currency formatted string' do
      price_to_currency(1050).should eq '$10.50'
      price_to_currency(10050).should eq '$100.50'
      price_to_currency(1).should eq '$0.01'
      price_to_currency(99).should eq '$0.99'
      price_to_currency(0).should eq '$0.00'
    end

    it 'raises an error when passed a decimal' do
      expect { price_to_currency(10.00) }.to raise_exception
    end

    it 'raises an error when passed nil' do
      expect { price_to_currency(nil) }.to raise_exception
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
effective_orders-1.4.1 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.4.0 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.13 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.12 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.11 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.10 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.9 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.8 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.7 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.6 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.5 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.4 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.3 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.2 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.1 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.3.0 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.2.13 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.2.12 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.2.11 spec/helpers/effective_orders_helper_spec.rb
effective_orders-1.2.10 spec/helpers/effective_orders_helper_spec.rb