diff --git a/test/models/media_test.rb b/test/models/media_test.rb index 38fd0bb8..6968659f 100644 --- a/test/models/media_test.rb +++ b/test/models/media_test.rb @@ -4,10 +4,16 @@ class MediaTest < ActiveSupport::TestCase include ActionCable::TestHelper + include ActiveJob::TestHelper setup do clear_media_data - Media.sync_all + + # Because Media.sync_all will cause others background jobs to be enqueued, + # we need to make sure all background jobs are performed. + perform_enqueued_jobs do + Media.sync_all + end end test "should create all records in database when synced" do