Fix the mock_file test helper.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4010 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
e4c5a91d0e
commit
9696557897
|
@ -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
|
||||||
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
|
||||||
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")
|
||||||
|
|
Loading…
Reference in New Issue