test/iostream_test.rb in paperclip-2.3.4 vs test/iostream_test.rb in paperclip-2.3.5
- old
+ new
@@ -1,16 +1,9 @@
require 'test/helper'
class IOStreamTest < Test::Unit::TestCase
- context "IOStream" do
- should "be included in IO, File, Tempfile, and StringIO" do
- [IO, File, Tempfile, StringIO].each do |klass|
- assert klass.included_modules.include?(IOStream), "Not in #{klass}"
- end
- end
- end
-
+ include IOStream
context "A file" do
setup do
@file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"), 'rb')
end
@@ -19,11 +12,11 @@
context "that is sent #stream_to" do
context "and given a String" do
setup do
FileUtils.mkdir_p(File.join(ROOT, 'tmp'))
- assert @result = @file.stream_to(File.join(ROOT, 'tmp', 'iostream.string.test'))
+ assert @result = stream_to(@file, File.join(ROOT, 'tmp', 'iostream.string.test'))
end
should "return a File" do
assert @result.is_a?(File)
end
@@ -36,11 +29,11 @@
context "and given a Tempfile" do
setup do
tempfile = Tempfile.new('iostream.test')
tempfile.binmode
- assert @result = @file.stream_to(tempfile)
+ assert @result = stream_to(@file, tempfile)
end
should "return a Tempfile" do
assert @result.is_a?(Tempfile)
end
@@ -51,12 +44,12 @@
end
end
end
- context "that is sent #to_tempfile" do
+ context "that is converted #to_tempfile" do
setup do
- assert @tempfile = @file.to_tempfile
+ assert @tempfile = to_tempfile(@file)
end
should "convert it to a Paperclip Tempfile" do
assert @tempfile.is_a?(Paperclip::Tempfile)
end