Commit a9cda45a by Philipp Brumm

fix tests

parent cb8d87d6
...@@ -5,6 +5,8 @@ class AttachmentAdapterTest < Test::Unit::TestCase ...@@ -5,6 +5,8 @@ class AttachmentAdapterTest < Test::Unit::TestCase
rebuild_model :path => "tmp/:class/:attachment/:style/:filename" rebuild_model :path => "tmp/:class/:attachment/:style/:filename"
@attachment = Dummy.new.avatar @attachment = Dummy.new.avatar
@file = File.new(fixture_file("5k.png")) @file = File.new(fixture_file("5k.png"))
@file.binmode
@attachment.assign(@file) @attachment.assign(@file)
@attachment.save @attachment.save
@subject = Paperclip.io_adapters.for(@attachment) @subject = Paperclip.io_adapters.for(@attachment)
......
...@@ -4,6 +4,7 @@ class FileAdapterTest < Test::Unit::TestCase ...@@ -4,6 +4,7 @@ class FileAdapterTest < Test::Unit::TestCase
context "a new instance" do context "a new instance" do
setup do setup do
@file = File.new(fixture_file("5k.png")) @file = File.new(fixture_file("5k.png"))
@file.binmode
@subject = Paperclip.io_adapters.for(@file) @subject = Paperclip.io_adapters.for(@file)
end end
......
...@@ -5,11 +5,14 @@ class UploadedFileAdapterTest < Test::Unit::TestCase ...@@ -5,11 +5,14 @@ class UploadedFileAdapterTest < Test::Unit::TestCase
context "with UploadedFile responding to #tempfile" do context "with UploadedFile responding to #tempfile" do
setup do setup do
class UploadedFile < OpenStruct; end class UploadedFile < OpenStruct; end
tempfile = File.new(fixture_file("5k.png"))
tempfile.binmode
@file = UploadedFile.new( @file = UploadedFile.new(
:original_filename => "5k.png", :original_filename => "5k.png",
:content_type => "image/png", :content_type => "image/png",
:head => "", :head => "",
:tempfile => File.new(fixture_file("5k.png")) :tempfile => tempfile
) )
@subject = Paperclip.io_adapters.for(@file) @subject = Paperclip.io_adapters.for(@file)
end end
...@@ -76,7 +79,9 @@ class UploadedFileAdapterTest < Test::Unit::TestCase ...@@ -76,7 +79,9 @@ class UploadedFileAdapterTest < Test::Unit::TestCase
end end
should "read the contents of the file" do should "read the contents of the file" do
expected = File.new(@file.path).read expected_file = File.new(@file.path)
expected_file.binmode
expected = expected_file.read
assert expected.length > 0 assert expected.length > 0
assert_equal expected, @subject.read assert_equal expected, @subject.read
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment