Sha256: dec028cfe96b3378cc98586fdaff0fcfd3f451d8306a9ec41b9f3e9e91483b15

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module Spree
  module Admin
    describe StockLocationsController, type: :controller do
      stub_authorization!
      
      # Regression for #4272
      context "with no countries present" do
        it "cannot create a new stock location" do
          spree_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 present" do
        before do
          country = FactoryGirl.create(:country)
          Spree::Config[:default_country_id] = country.id
        end

        it "can create a new stock location" do
          spree_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
          spree_get :new
          expect(response).to be_success
        end 
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_backend-3.3.0.rc1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
spree_backend-3.2.1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
spree_backend-3.2.0 spec/controllers/spree/admin/stock_locations_controller_spec.rb
spree_backend-3.2.0.rc3 spec/controllers/spree/admin/stock_locations_controller_spec.rb
spree_backend-3.2.0.rc2 spec/controllers/spree/admin/stock_locations_controller_spec.rb
spree_backend-3.2.0.rc1 spec/controllers/spree/admin/stock_locations_controller_spec.rb