Skip to content

Commit af02b9b

Browse files
Remove unnecessary tap
1 parent e13e16f commit af02b9b

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

activestorage/test/models/attached/many_test.rb

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,17 @@ class ActiveStorage::ManyAttachedTest < ActiveSupport::TestCase
170170
end
171171

172172
test "replacing existing, independent attachments on an existing record via assign and attach" do
173-
[ create_blob(filename: "funky.mp4"), create_blob(filename: "town.mp4") ].tap do |old_blobs|
174-
@user.vlogs.attach old_blobs
175-
176-
@user.vlogs = []
177-
assert_not @user.vlogs.attached?
173+
@user.vlogs.attach create_blob(filename: "funky.mp4"), create_blob(filename: "town.mp4")
178174

179-
assert_no_enqueued_jobs only: ActiveStorage::PurgeJob do
180-
@user.vlogs.attach create_blob(filename: "whenever.mp4"), create_blob(filename: "wherever.mp4")
181-
end
175+
@user.vlogs = []
176+
assert_not @user.vlogs.attached?
182177

183-
assert_equal "whenever.mp4", @user.vlogs.first.filename.to_s
184-
assert_equal "wherever.mp4", @user.vlogs.second.filename.to_s
178+
assert_no_enqueued_jobs only: ActiveStorage::PurgeJob do
179+
@user.vlogs.attach create_blob(filename: "whenever.mp4"), create_blob(filename: "wherever.mp4")
185180
end
181+
182+
assert_equal "whenever.mp4", @user.vlogs.first.filename.to_s
183+
assert_equal "wherever.mp4", @user.vlogs.second.filename.to_s
186184
end
187185

188186
test "successfully updating an existing record to replace existing, dependent attachments" do

0 commit comments

Comments
 (0)