Skip to content

Commit

Permalink
Merge pull request #45665 from skipkayhil/fix-deprecation-storage-tests
Browse files Browse the repository at this point in the history
Fix some deprecation warnings in many_test
  • Loading branch information
yahonda committed Jul 27, 2022
2 parents 8b94e87 + 0a97813 commit ab325a9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions activestorage/test/models/attached/many_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,11 @@ class ActiveStorage::ManyAttachedTest < ActiveSupport::TestCase

test "attaching new blobs within a transaction with append_on_assign config uploads all the files" do
append_on_assign do
ActiveRecord::Base.transaction do
@user.highlights.attach fixture_file_upload("racecar.jpg")
@user.highlights.attach fixture_file_upload("video.mp4")
assert_deprecated do
ActiveRecord::Base.transaction do
@user.highlights.attach fixture_file_upload("racecar.jpg")
@user.highlights.attach fixture_file_upload("video.mp4")
end
end

assert_equal "racecar.jpg", @user.highlights.first.filename.to_s
Expand All @@ -221,10 +223,12 @@ class ActiveStorage::ManyAttachedTest < ActiveSupport::TestCase

test "attaching new blobs within a transaction with append_on_assign config create the exact amount of records" do
append_on_assign do
assert_difference -> { ActiveStorage::Blob.count }, +2 do
ActiveRecord::Base.transaction do
@user.highlights.attach fixture_file_upload("racecar.jpg")
@user.highlights.attach fixture_file_upload("video.mp4")
assert_deprecated do
assert_difference -> { ActiveStorage::Blob.count }, +2 do
ActiveRecord::Base.transaction do
@user.highlights.attach fixture_file_upload("racecar.jpg")
@user.highlights.attach fixture_file_upload("video.mp4")
end
end
end

Expand Down

0 comments on commit ab325a9

Please sign in to comment.