Sha256: 0da2a3fd93f59dcfe8cb8a72b7f5409c617c9cb38fc6b576cdcc1d4c7279ebbf

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 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
          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 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
          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
solidus_backend-1.3.2 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-1.3.1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-1.3.0 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-1.3.0.rc2 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-1.3.0.rc1 spec/controllers/spree/admin/stock_locations_controller_spec.rb
solidus_backend-1.3.0.beta1 spec/controllers/spree/admin/stock_locations_controller_spec.rb