Sha256: 8b5a98e05febdcbe532e6bcdff35483ffed6363bf74aa7c3bae8b6a5dde02ed6

Contents?: true

Size: 1.17 KB

Versions: 14

Compression:

Stored size: 1.17 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
          stub_spree_preferences(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

14 entries across 14 versions & 1 rubygems

Version Path
solidus_backend-2.10.5 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.10.3 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.10.2 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.9.6 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.10.1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.9.5 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.10.0 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.9.4 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.9.3 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.9.2 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.10.0.beta1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.9.1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.9.0 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.9.0.rc.1 spec/controllers/spree/admin/stock_locations_controller_spec.rb