Sha256: d623eba0ad1c12a314417a847699c020ec562c4e9a4673b748a80bc5b9750e83

Contents?: true

Size: 1.16 KB

Versions: 33

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

module Spree
  module Admin
    describe StockLocationsController, type: :controller do
      stub_authorization!

      # Regression for https://github.com/spree/spree/issues/4272
      context "with no countries present" do
        it "cannot create a new stock location" do
          get :new
          expect(flash[:error]).to eq(I18n.t('spree.stock_locations_need_a_default_country'))
          expect(response).to redirect_to(spree.admin_stock_locations_path)
        end
      end

      context "with a default country other than the US present" do
        let(:country) { create :country, iso: "BR" }

        before do
          Spree::Config[:default_country_iso] = country.iso
        end

        it "can create a new stock location" do
          get :new
          expect(response).to be_successful
        end
      end

      context "with a country with the ISO code of 'US' existing" do
        before do
          FactoryBot.create(:country, iso: 'US')
        end

        it "can create a new stock location" do
          get :new
          expect(response).to be_successful
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
solidus_backend-2.8.6 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.6.6 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.7.4 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.8.5 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.7.3 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.6.5 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.8.4 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.8.3 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.7.2 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.6.4 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.8.2 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.8.1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.6.3 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.8.0 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.7.1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.6.2 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.14 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.13 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.12 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.11 spec/controllers/spree/admin/stock_locations_controller_spec.rb