Sha256: 4fbcfd7676e376ec888bd01254991a3bda4aa6b8ac6a6cb4acf2ed6ccc4a6bc2

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 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) }
    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

1 entries across 1 versions & 1 rubygems

Version Path
kdmny-spree-0.0.1 test/unit/helpers/spree/base_helper_test.rb