File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
activestorage/test/models/attached Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -170,19 +170,17 @@ class ActiveStorage::ManyAttachedTest < ActiveSupport::TestCase
170
170
end
171
171
172
172
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" )
178
174
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?
182
177
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" )
185
180
end
181
+
182
+ assert_equal "whenever.mp4" , @user . vlogs . first . filename . to_s
183
+ assert_equal "wherever.mp4" , @user . vlogs . second . filename . to_s
186
184
end
187
185
188
186
test "successfully updating an existing record to replace existing, dependent attachments" do
You can’t perform that action at this time.
0 commit comments