Merge pull request #37448 from gmcgibbon/fix_flaky_activestorage_tests
Fix flaky activestorage tests
This commit is contained in:
commit
d1b39eaf12
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "active_storage/downloader"
|
||||
|
||||
# A blob is a record that contains the metadata about a file and a key for where that file resides on the service.
|
||||
# Blobs can be created in two ways:
|
||||
#
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "active_storage/log_subscriber"
|
||||
require "active_storage/downloader"
|
||||
require "action_dispatch"
|
||||
require "action_dispatch/http/content_disposition"
|
||||
|
||||
|
|
|
@ -10,7 +10,9 @@ class ActiveStorage::ManyAttachedTest < ActiveSupport::TestCase
|
|||
@user = User.create!(name: "Josh")
|
||||
end
|
||||
|
||||
teardown { ActiveStorage::Blob.all.each(&:delete) }
|
||||
teardown do
|
||||
ActiveStorage::Blob.all.each(&:delete)
|
||||
end
|
||||
|
||||
test "attaching existing blobs to an existing record" do
|
||||
@user.highlights.attach create_blob(filename: "funky.jpg"), create_blob(filename: "town.jpg")
|
||||
|
|
|
@ -12,7 +12,9 @@ class ActiveStorage::OneAttachedTest < ActiveSupport::TestCase
|
|||
@user = User.create!(name: "Josh")
|
||||
end
|
||||
|
||||
teardown { ActiveStorage::Blob.all.each(&:delete) }
|
||||
teardown do
|
||||
ActiveStorage::Blob.all.each(&:delete)
|
||||
end
|
||||
|
||||
test "attaching an existing blob to an existing record" do
|
||||
@user.avatar.attach create_blob(filename: "funky.jpg")
|
||||
|
|
|
@ -52,6 +52,8 @@ ActiveStorage.verifier = ActiveSupport::MessageVerifier.new("Testing")
|
|||
class ActiveSupport::TestCase
|
||||
self.file_fixture_path = File.expand_path("fixtures/files", __dir__)
|
||||
|
||||
include ActiveRecord::TestFixtures
|
||||
|
||||
setup do
|
||||
ActiveStorage::Current.host = "https://example.com"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue