Commit 96965578 authored by Eric Davis's avatar Eric Davis

Fix the mock_file test helper.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4010 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent e4c5a91d
...@@ -12,6 +12,6 @@ class Attachment < ActiveRecord::Base ...@@ -12,6 +12,6 @@ class Attachment < ActiveRecord::Base
end end
def self.generate_file def self.generate_file
@file = mock_file @file = ActiveSupport::TestCase.mock_file
end end
end end
...@@ -63,7 +63,7 @@ class ActiveSupport::TestCase ...@@ -63,7 +63,7 @@ class ActiveSupport::TestCase
end end
# Mock out a file # Mock out a file
def mock_file def self.mock_file
file = 'a_file.png' file = 'a_file.png'
file.stubs(:size).returns(32) file.stubs(:size).returns(32)
file.stubs(:original_filename).returns('a_file.png') file.stubs(:original_filename).returns('a_file.png')
...@@ -72,6 +72,10 @@ class ActiveSupport::TestCase ...@@ -72,6 +72,10 @@ class ActiveSupport::TestCase
file file
end end
def mock_file
self.class.mock_file
end
# Use a temporary directory for attachment related tests # Use a temporary directory for attachment related tests
def set_tmp_attachments_directory def set_tmp_attachments_directory
Dir.mkdir "#{RAILS_ROOT}/tmp/test" unless File.directory?("#{RAILS_ROOT}/tmp/test") Dir.mkdir "#{RAILS_ROOT}/tmp/test" unless File.directory?("#{RAILS_ROOT}/tmp/test")
......
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