diff options
Diffstat (limited to 'activestorage/test')
-rw-r--r-- | activestorage/test/models/attachments_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activestorage/test/models/attachments_test.rb b/activestorage/test/models/attachments_test.rb index 4c6b3e6000..25e0352eca 100644 --- a/activestorage/test/models/attachments_test.rb +++ b/activestorage/test/models/attachments_test.rb @@ -68,6 +68,18 @@ class ActiveStorage::AttachmentsTest < ActiveSupport::TestCase end end + test "replaced attached blob with itself by signed ID" do + @user.avatar.attach create_blob(filename: "funky.jpg") + + assert_no_changes -> { @user.reload.avatar.blob } do + assert_no_changes -> { @user.reload.avatar.attachment } do + assert_no_enqueued_jobs do + @user.avatar.attach @user.avatar.blob.signed_id + end + end + end + end + test "attach blob to new record" do user = User.new(name: "Jason") |