Sha256: 76df59b499bdb135a73ad960f0f366af932dd56e5887cbdbec5dd5cc070e2bba

Contents?: true

Size: 1.62 KB

Versions: 30

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Spree::Core::StockConfiguration do
  describe '#coordinator_class' do
    let(:stock_configuration) { described_class.new }
    subject { stock_configuration.coordinator_class }

    it "returns Spree::Stock::Coordinator" do
      is_expected.to be ::Spree::Stock::SimpleCoordinator
    end

    context "with another constant name assiged" do
      MyCoordinator = Class.new
      before { stock_configuration.coordinator_class = MyCoordinator.to_s }

      it "returns the constant" do
        is_expected.to be MyCoordinator
      end
    end
  end

  describe '#estimator_class' do
    let(:stock_configuration) { described_class.new }
    subject { stock_configuration.estimator_class }

    it "returns Spree::Stock::Estimator" do
      is_expected.to be ::Spree::Stock::Estimator
    end

    context "with another constant name assiged" do
      MyEstimator = Class.new
      before { stock_configuration.estimator_class = MyEstimator.to_s }

      it "returns the constant" do
        is_expected.to be MyEstimator
      end
    end
  end

  describe '#location_sorter_class' do
    let(:stock_configuration) { described_class.new }
    subject { stock_configuration.location_sorter_class }

    it "returns Spree::Stock::LocationSorter::Unsorted" do
      is_expected.to be ::Spree::Stock::LocationSorter::Unsorted
    end

    context "with another constant name assiged" do
      MySorter = Class.new
      before { stock_configuration.location_sorter_class = MySorter.to_s }

      it "returns the constant" do
        is_expected.to be MySorter
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
solidus_core-2.9.6 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.8.6 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.9.5 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.9.4 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.8.5 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.9.3 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.9.2 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.10.0.beta1 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.9.1 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.9.0 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.9.0.rc.1 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.8.4 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.8.3 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.8.2 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.8.1 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core-2.8.0 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.14 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.13 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.12 spec/lib/spree/core/stock_configuration_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.11 spec/lib/spree/core/stock_configuration_spec.rb