mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-03 06:59:14 +00:00
Remove the need to import both :role and :state factory to OFN
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user