Permalink
Browse files

Changed some file accesses into StringIOs in tests

  • Loading branch information...
1 parent a23c21e commit bbd6d063c3bc0e70322e2d25307b9ec57ad00298 @jyurek jyurek committed Feb 7, 2009
Showing with 4 additions and 8 deletions.
  1. +4 −8 test/attachment_test.rb
View
@@ -95,14 +95,10 @@ class AttachmentTest < Test::Unit::TestCase
rebuild_model :path => ":rails_env/:id.png"
@dummy = Dummy.new
@dummy.stubs(:id).returns(@id)
- @file = File.new(File.join(File.dirname(__FILE__),
- "fixtures",
- "5k.png"), 'rb')
+ @file = StringIO.new(".")
@dummy.avatar = @file
end
- teardown { @file.close }
-
should "return the proper path" do
temporary_rails_env(@rails_env) {
assert_equal "#{@rails_env}/#{@id}.png", @dummy.avatar.path
@@ -176,7 +172,7 @@ def thumb; "-thumb"; end
{ :geometry => lambda{|z| "50x50#" } }
]
geometry_specs.each do |geometry_spec|
- context "An attachment geomtry like #{geometry_spec}" do
+ context "An attachment geometry like #{geometry_spec}" do
setup do
rebuild_model :styles => { :normal => geometry_spec }
@attachment = Dummy.new.avatar
@@ -299,7 +295,7 @@ def do_after_avatar; end
def do_before_all; end
def do_after_all; end
end
- @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb')
+ @file = StringIO.new(".")
@file.stubs(:to_tempfile).returns(@file)
@dummy = Dummy.new
Paperclip::Thumbnail.stubs(:make).returns(@file)
@@ -346,7 +342,7 @@ def do_after_all; end
context "Assigning an attachment" do
setup do
rebuild_model :styles => { :something => "100x100#" }
- @file = File.new(File.join(FIXTURES_DIR, "5k.png"), 'rb')
+ @file = StringIO.new(".")
@file.expects(:original_filename).returns("5k.png\n\n")
@file.expects(:content_type).returns("image/png\n\n")
@file.stubs(:to_tempfile).returns(@file)

0 comments on commit bbd6d06

Please sign in to comment.