Sha256: 5e78dd009152c48b7bf1227fbb771375e0b8665fbdfb5ac55f8c58b340f38840

Contents?: true

Size: 1.53 KB

Versions: 15

Compression:

Stored size: 1.53 KB

Contents

require 'test_helper'

class Spree::BaseHelperTest < ActionView::TestCase
  context "when backordering is allowed" do
    setup do 
      Spree::Config.set(:allow_backorders => true)
    end
    context "and variant is out of stock" do
      setup { @variant = Factory(:variant, :on_hand => "0")}
      context "variant_options" do
        setup { @variant_options = variant_options(@variant) }
        should "not mention out of stock" do
          assert !@variant_options.include?("Out of Stock")
        end
      end
      context "variant_options(allow_backordering=false)" do
        setup { @variant_options = variant_options(@variant, false) }
        should "not mention out of stock" do
          assert @variant_options.include?("Out of Stock")
        end
      end
    end
  end
  context "when backordering is disallowed" do
    setup { Spree::Config.set(:allow_backorders => false) }
    teardown { Spree::Config.set(:allow_backorders => true) }
    context "and variant is out of stock" do
      setup { @variant = Factory(:variant, :on_hand => "0")}
      context "variant_options" do
        setup { @variant_options = variant_options(@variant) }
        should "not mention out of stock" do
          assert @variant_options.include?("Out of Stock")
        end
      end
      context "variant_options(allow_backordering=true)" do
        setup { @variant_options = variant_options(@variant, true) }
        should "not mention out of stock" do
          assert !@variant_options.include?("Out of Stock")
        end
      end
    end
  end  
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
spree-0.11.4 test/unit/helpers/spree/base_helper_test.rb
spree-0.11.3 test/unit/helpers/spree/base_helper_test.rb
spree-0.11.2 test/unit/helpers/spree/base_helper_test.rb
spree-0.11.1 test/unit/helpers/spree/base_helper_test.rb
spree-0.11.0 test/unit/helpers/spree/base_helper_test.rb
spree-0.10.2 test/unit/helpers/spree/base_helper_test.rb
spree-0.10.1 test/unit/helpers/spree/base_helper_test.rb
spree-0.10.0 test/unit/helpers/spree/base_helper_test.rb
spree-0.10.0.beta test/unit/helpers/spree/base_helper_test.rb
spree-enriquez-0.9.4 test/unit/helpers/spree/base_helper_test.rb
spree-0.9.4 test/unit/helpers/spree/base_helper_test.rb
spree-0.9.3 test/unit/helpers/spree/base_helper_test.rb
spree-0.9.2 test/unit/helpers/spree/base_helper_test.rb
spree-0.9.1 test/unit/helpers/spree/base_helper_test.rb
spree-0.9.0 test/unit/helpers/spree/base_helper_test.rb