test/iostream_test.rb in tristandunn-paperclip-2.3.1 vs test/iostream_test.rb in tristandunn-paperclip-2.3.1.1
- old
+ new
@@ -56,11 +56,18 @@
context "that is sent #to_tempfile" do
setup do
assert @tempfile = @file.to_tempfile
end
- should "convert it to a Tempfile" do
- assert @tempfile.is_a?(Tempfile)
+ should "convert it to a Paperclip Tempfile" do
+ assert @tempfile.is_a?(Paperclip::Tempfile)
+ end
+
+ should "have the name be based on the original_filename" do
+ name = File.basename(@file.path)
+ extension = File.extname(name)
+ basename = File.basename(name, extension)
+ assert_match %r[^#{Regexp.quote(basename)}.*?#{Regexp.quote(extension)}], File.basename(@tempfile.path)
end
should "have the Tempfile contain the same data as the file" do
@file.rewind; @tempfile.rewind
assert_equal @file.read, @tempfile.read