Remove the need to import both :role and :state factory to OFN

This commit is contained in:
Luis Ramos
2020-08-23 14:47:30 +01:00
parent 292199441a
commit 2abbfad18c
3 changed files with 3 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ FactoryBot.define do
end
factory :admin_user do
spree_roles { [Spree::Role.find_by(name: 'admin') || create(:role, name: 'admin')] }
spree_roles { [Spree::Role.find_or_create_by!(name: 'admin')] }
after(:create) do |user|
user.spree_roles << Spree::Role.find_or_create_by!(name: 'admin')

View File

@@ -25,7 +25,7 @@ describe "States" do
end
context "admin visiting states listing" do
let!(:state) { create(:state, country: country) }
let!(:state) { Spree::State.create(name: 'Alabama', country: country) }
it "should correctly display the states" do
visit spree.admin_country_states_path(country)

View File

@@ -33,7 +33,7 @@ describe DefaultStockLocation do
context 'when a location named default already exists' do
let!(:location) do
country = create(:country)
state = create(:state, country: country)
state = Spree::State.create(name: 'Alabama', country: country)
Spree::StockLocation.create!(
name: 'default',
country_id: country.id,