Sha256: 15b8aaf02b0c809581a332ddf73ab389eea0821ae33475d06962b22092902a03

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

class ProductsHelperTest < ActionView::TestCase
  context "format_price" do
    setup { @price = 100 }
    should "format the price using $ when locale is en-US" do
      assert format_price(@price).include?("$100.00")
    end
    should "should include the '(inc. VAT)' text when options[:show_vat_text] => true" do
      assert_equal "$100.00 (inc. VAT)", format_price(@price, :show_vat_text => true)
    end
    should "not include the '(inc. VAT)' text when options[:show_vat_text] => false" do
      assert_equal "$100.00", format_price(@price, :show_vat_text => false)
    end
    context "with options[:show_vat_text] => nil" do
      should "include the '(inc. VAT)' text when Spree::Config[:show_price_inc_vat] => true" do
        Spree::Config.set(:show_price_inc_vat => true)
        assert_equal "$100.00 (inc. VAT)", format_price(@price)
      end
      should "not include the '(inc. VAT)' text when Spree::onfig[:show_price_inc_vat] => false" do
        Spree::Config.set(:show_price_inc_vat => false)
        assert_equal "$100.00", format_price(@price)
      end
    end    
  end  
=begin
  should "format the price using $ when locale is es" do
    I18n.locale = "es"
    assert_equal "100,00 €", format_price(@price)
  end 
=end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
spree-0.10.2 test/unit/helpers/products_helper_test.rb
spree-0.10.1 test/unit/helpers/products_helper_test.rb
spree-0.10.0 test/unit/helpers/products_helper_test.rb
spree-0.10.0.beta test/unit/helpers/products_helper_test.rb
spree-enriquez-0.9.4 test/unit/helpers/products_helper_test.rb
spree-0.9.4 test/unit/helpers/products_helper_test.rb
spree-0.9.3 test/unit/helpers/products_helper_test.rb
spree-0.9.2 test/unit/helpers/products_helper_test.rb
spree-0.9.1 test/unit/helpers/products_helper_test.rb
spree-0.9.0 test/unit/helpers/products_helper_test.rb