Sha256: 32479c0652084d2b9359aacc679ec40b3fdcf5ae54e4ff7c7cbfdaafbffb5297

Contents?: true

Size: 1.12 KB

Versions: 31

Compression:

Stored size: 1.12 KB

Contents

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(Spree.t(: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_success
        end
      end

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

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

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
solidus_backend-2.2.0.beta1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.1.0 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.1.0.rc1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.0.1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.1.0.beta1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.0.0 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-1.4.0 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.0.0.rc1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-1.4.0.rc1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-2.0.0.beta1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-1.4.0.beta1 spec/controllers/spree/admin/stock_locations_controller_spec.rb