Sha256: fc8c738d9898c7817dbd1bbc108b80336258381f5b865044a007091464e88104

Contents?: true

Size: 1.64 KB

Versions: 34

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Spree::AppConfiguration, type: :model do
  let(:prefs) { Spree::Config }

  it "should be available from the environment" do
    prefs.layout = "my/layout"
    expect(prefs.layout).to eq "my/layout"
  end

  it "should be available as Spree::Config for legacy access" do
    expect(Spree::Config).to be_a Spree::AppConfiguration
  end

  it "uses base searcher class by default" do
    expect(prefs.searcher_class).to eq Spree::Core::Search::Base
  end

  it "uses variant search class by default" do
    expect(prefs.variant_search_class).to eq Spree::Core::Search::Variant
  end

  it "uses variant price selector class by default" do
    expect(prefs.variant_price_selector_class).to eq Spree::Variant::PriceSelector
  end

  it "has a getter for the pricing options class provided by the variant price selector class" do
    expect(prefs.pricing_options_class).to eq Spree::Variant::PriceSelector.pricing_options_class
  end

  describe '#stock' do
    subject { prefs.stock }
    it { is_expected.to be_a Spree::Core::StockConfiguration }
  end

  describe '@default_country_iso_code' do
    it 'is the USA by default' do
      expect(prefs[:default_country_iso]).to eq("US")
    end
  end

  describe '@admin_vat_country_iso' do
    it 'is `nil` by default' do
      expect(prefs[:admin_vat_country_iso]).to eq(nil)
    end
  end

  it 'has a default admin VAT location with nil values by default' do
    expect(prefs.admin_vat_location).to eq(Spree::Tax::TaxLocation.new)
    expect(prefs.admin_vat_location.state_id).to eq(nil)
    expect(prefs.admin_vat_location.country_id).to eq(nil)
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
solidus_core-2.8.6 spec/models/spree/app_configuration_spec.rb
solidus_core-2.6.6 spec/models/spree/app_configuration_spec.rb
solidus_core-2.7.4 spec/models/spree/app_configuration_spec.rb
solidus_core-2.8.5 spec/models/spree/app_configuration_spec.rb
solidus_core-2.7.3 spec/models/spree/app_configuration_spec.rb
solidus_core-2.6.5 spec/models/spree/app_configuration_spec.rb
solidus_core-2.8.4 spec/models/spree/app_configuration_spec.rb
solidus_core-2.8.3 spec/models/spree/app_configuration_spec.rb
solidus_core-2.7.2 spec/models/spree/app_configuration_spec.rb
solidus_core-2.6.4 spec/models/spree/app_configuration_spec.rb
solidus_core-2.8.2 spec/models/spree/app_configuration_spec.rb
solidus_core-2.8.1 spec/models/spree/app_configuration_spec.rb
solidus_core-2.6.3 spec/models/spree/app_configuration_spec.rb
solidus_core-2.8.0 spec/models/spree/app_configuration_spec.rb
solidus_core-2.7.1 spec/models/spree/app_configuration_spec.rb
solidus_core-2.6.2 spec/models/spree/app_configuration_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.14 spec/models/spree/app_configuration_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.13 spec/models/spree/app_configuration_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.12 spec/models/spree/app_configuration_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.11 spec/models/spree/app_configuration_spec.rb