From a934767049e459c668ec9b4a4b1275d8766ac94e Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 14 Apr 2024 18:24:04 +0200 Subject: [PATCH] Specs: Prevent Rake task from being executed twice Otherwise, invoking a Rake task could lead to multiple executions, which is unexpected. --- spec/db/seeds_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/db/seeds_spec.rb b/spec/db/seeds_spec.rb index 7a7b20e4..8c375a6c 100644 --- a/spec/db/seeds_spec.rb +++ b/spec/db/seeds_spec.rb @@ -6,7 +6,7 @@ RSpec.describe 'seeds' do subject(:seed) { Rake::Task['db:seed'].invoke } before do - CodeOcean::Application.load_tasks + Rails.application.load_tasks if Rake::Task.tasks.empty? # We need to migrate the test database before seeding # Otherwise, Rails 7.1+ will throw an `NoMethodError`: `pending_migrations.any?`