aboutsummaryrefslogtreecommitdiffstats
path: root/test/models/attachments_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-09 18:48:26 +0200
committerKasper Timm Hansen <kaspth@gmail.com>2017-07-23 21:17:17 +0200
commit5963766d840ddcdb577a1bd10eb1491a4ef9132f (patch)
treee6cba96cac8865435486ba08a1a5fc0f04d6e9f7 /test/models/attachments_test.rb
parent4efbeaeaab72be070e203f39726b37703c1db1fa (diff)
downloadrails-5963766d840ddcdb577a1bd10eb1491a4ef9132f.tar.gz
rails-5963766d840ddcdb577a1bd10eb1491a4ef9132f.tar.bz2
rails-5963766d840ddcdb577a1bd10eb1491a4ef9132f.zip
Explore regular polymorphic associations rather than record_gid
Diffstat (limited to 'test/models/attachments_test.rb')
-rw-r--r--test/models/attachments_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/models/attachments_test.rb b/test/models/attachments_test.rb
index c0f5db819d..1a9fc6f932 100644
--- a/test/models/attachments_test.rb
+++ b/test/models/attachments_test.rb
@@ -68,6 +68,14 @@ class ActiveStorage::AttachmentsTest < ActiveSupport::TestCase
assert_equal "country.jpg", @user.highlights.second.filename.to_s
end
+ test "find attached blobs" do
+ @user.highlights.attach(
+ { io: StringIO.new("STUFF"), filename: "town.jpg", content_type: "image/jpg" },
+ { io: StringIO.new("IT"), filename: "country.jpg", content_type: "image/jpg" })
+
+ User.where(id: @user.id).includes(highlights_attachments: :blob).first
+ end
+
test "purge attached blobs" do
@user.highlights.attach create_blob(filename: "funky.jpg"), create_blob(filename: "wonky.jpg")
highlight_keys = @user.highlights.collect(&:key)