aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test/models/blob_test.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-05-30 20:01:07 -0400
committerGeorge Claghorn <george@basecamp.com>2018-05-30 20:05:39 -0400
commita6d80e164f2f5566472370a84ab7cd98736666c4 (patch)
treebde6f7b857255fd12d81702d23debd7b995876c2 /activestorage/test/models/blob_test.rb
parente2e053608ed71d22d7f3e22af605ab284ef00f05 (diff)
downloadrails-a6d80e164f2f5566472370a84ab7cd98736666c4.tar.gz
rails-a6d80e164f2f5566472370a84ab7cd98736666c4.tar.bz2
rails-a6d80e164f2f5566472370a84ab7cd98736666c4.zip
Include blob ID in tempfile name for debugging convenience
Diffstat (limited to 'activestorage/test/models/blob_test.rb')
-rw-r--r--activestorage/test/models/blob_test.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/activestorage/test/models/blob_test.rb b/activestorage/test/models/blob_test.rb
index 2d1857041d..788e9af7b8 100644
--- a/activestorage/test/models/blob_test.rb
+++ b/activestorage/test/models/blob_test.rb
@@ -85,11 +85,15 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase
end
test "open with integrity" do
- create_file_blob(filename: "racecar.jpg").open do |file|
- assert file.binmode?
- assert_equal 0, file.pos
- assert_match(/\.jpg\z/, file.path)
- assert_equal file_fixture("racecar.jpg").binread, file.read, "Expected downloaded file to match fixture file"
+ create_file_blob(filename: "racecar.jpg").tap do |blob|
+ blob.open do |file|
+ assert file.binmode?
+ assert_equal 0, file.pos
+ byebug
+ assert File.basename(file.path).starts_with?("ActiveStorage-#{blob.id}-")
+ assert file.path.ends_with?(".jpg")
+ assert_equal file_fixture("racecar.jpg").binread, file.read, "Expected downloaded file to match fixture file"
+ end
end
end