Sha256: 491f34a25b7a9d891aa483c972955efa95c93d610d7aa8680014438ac3822098

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 Bytes

Contents

require 'spec_helper'

describe EffectiveOrdersHelper, :type => :helper 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

1 entries across 1 versions & 1 rubygems

Version Path
effective_orders-1.6.5 spec/helpers/effective_orders_helper_spec.rb