Specs: Prevent Rake task from being executed twice
Otherwise, invoking a Rake task could lead to multiple executions, which is unexpected.
This commit is contained in:

committed by
Dominic Sauer

parent
681e8ec444
commit
a934767049
@ -6,7 +6,7 @@ RSpec.describe 'seeds' do
|
|||||||
subject(:seed) { Rake::Task['db:seed'].invoke }
|
subject(:seed) { Rake::Task['db:seed'].invoke }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
CodeOcean::Application.load_tasks
|
Rails.application.load_tasks if Rake::Task.tasks.empty?
|
||||||
|
|
||||||
# We need to migrate the test database before seeding
|
# We need to migrate the test database before seeding
|
||||||
# Otherwise, Rails 7.1+ will throw an `NoMethodError`: `pending_migrations.any?`
|
# Otherwise, Rails 7.1+ will throw an `NoMethodError`: `pending_migrations.any?`
|
||||||
|
Reference in New Issue
Block a user