summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-08-19 22:24:42 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-08-19 22:24:42 +0000
commit969655789792e6f77ff7dc67bb83e20fadffeb2f (patch)
treed4cc02e4a68f7e15d187e2860f7e13f4b7a58ae6 /test
parente4c5a91d0e9214485a13dec0a68225eeee16ee99 (diff)
downloadredmine-969655789792e6f77ff7dc67bb83e20fadffeb2f.tar.gz
redmine-969655789792e6f77ff7dc67bb83e20fadffeb2f.zip
Fix the mock_file test helper.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4010 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/exemplars/attachment_exemplar.rb2
-rw-r--r--test/test_helper.rb8
2 files changed, 7 insertions, 3 deletions
diff --git a/test/exemplars/attachment_exemplar.rb b/test/exemplars/attachment_exemplar.rb
index 8100fe906..4baaf530f 100644
--- a/test/exemplars/attachment_exemplar.rb
+++ b/test/exemplars/attachment_exemplar.rb
@@ -12,6 +12,6 @@ class Attachment < ActiveRecord::Base
end
def self.generate_file
- @file = mock_file
+ @file = ActiveSupport::TestCase.mock_file
end
end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index dc04fa82d..9a2761021 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -63,7 +63,7 @@ class ActiveSupport::TestCase
end
# Mock out a file
- def mock_file
+ def self.mock_file
file = 'a_file.png'
file.stubs(:size).returns(32)
file.stubs(:original_filename).returns('a_file.png')
@@ -71,7 +71,11 @@ class ActiveSupport::TestCase
file.stubs(:read).returns(false)
file
end
-
+
+ def mock_file
+ self.class.mock_file
+ end
+
# Use a temporary directory for attachment related tests
def set_tmp_attachments_directory
Dir.mkdir "#{RAILS_ROOT}/tmp/test" unless File.directory?("#{RAILS_ROOT}/tmp/test")