summaryrefslogtreecommitdiff
path: root/vendor/plugins/paperclip/test/iostream_test.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
commit9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch)
tree8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /vendor/plugins/paperclip/test/iostream_test.rb
parent85a01e35274b8d4d4165a7b26bd7986e211246bb (diff)
parent1853082fcd8c067390c246f9daa01a9b47387497 (diff)
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'vendor/plugins/paperclip/test/iostream_test.rb')
-rw-r--r--vendor/plugins/paperclip/test/iostream_test.rb71
1 files changed, 0 insertions, 71 deletions
diff --git a/vendor/plugins/paperclip/test/iostream_test.rb b/vendor/plugins/paperclip/test/iostream_test.rb
deleted file mode 100644
index 97030b5..0000000
--- a/vendor/plugins/paperclip/test/iostream_test.rb
+++ /dev/null
@@ -1,71 +0,0 @@
1require 'test/helper'
2
3class IOStreamTest < Test::Unit::TestCase
4 context "IOStream" do
5 should "be included in IO, File, Tempfile, and StringIO" do
6 [IO, File, Tempfile, StringIO].each do |klass|
7 assert klass.included_modules.include?(IOStream), "Not in #{klass}"
8 end
9 end
10 end
11
12 context "A file" do
13 setup do
14 @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"), 'rb')
15 end
16
17 teardown { @file.close }
18
19 context "that is sent #stream_to" do
20
21 context "and given a String" do
22 setup do
23 FileUtils.mkdir_p(File.join(ROOT, 'tmp'))
24 assert @result = @file.stream_to(File.join(ROOT, 'tmp', 'iostream.string.test'))
25 end
26
27 should "return a File" do
28 assert @result.is_a?(File)
29 end
30
31 should "contain the same data as the original file" do
32 @file.rewind; @result.rewind
33 assert_equal @file.read, @result.read
34 end
35 end
36
37 context "and given a Tempfile" do
38 setup do
39 tempfile = Tempfile.new('iostream.test')
40 tempfile.binmode
41 assert @result = @file.stream_to(tempfile)
42 end
43
44 should "return a Tempfile" do
45 assert @result.is_a?(Tempfile)
46 end
47
48 should "contain the same data as the original file" do
49 @file.rewind; @result.rewind
50 assert_equal @file.read, @result.read
51 end
52 end
53
54 end
55
56 context "that is sent #to_tempfile" do
57 setup do
58 assert @tempfile = @file.to_tempfile
59 end
60
61 should "convert it to a Tempfile" do
62 assert @tempfile.is_a?(Tempfile)
63 end
64
65 should "have the Tempfile contain the same data as the file" do
66 @file.rewind; @tempfile.rewind
67 assert_equal @file.read, @tempfile.read
68 end
69 end
70 end
71end