@@ -12,6 +12,6 class Attachment < ActiveRecord::Base | |||
|
12 | 12 | end |
|
13 | 13 | |
|
14 | 14 | def self.generate_file |
|
15 | @file = mock_file | |
|
15 | @file = ActiveSupport::TestCase.mock_file | |
|
16 | 16 | end |
|
17 | 17 | end |
@@ -63,7 +63,7 class ActiveSupport::TestCase | |||
|
63 | 63 | end |
|
64 | 64 | |
|
65 | 65 | # Mock out a file |
|
66 | def mock_file | |
|
66 | def self.mock_file | |
|
67 | 67 | file = 'a_file.png' |
|
68 | 68 | file.stubs(:size).returns(32) |
|
69 | 69 | file.stubs(:original_filename).returns('a_file.png') |
@@ -71,7 +71,11 class ActiveSupport::TestCase | |||
|
71 | 71 | file.stubs(:read).returns(false) |
|
72 | 72 | file |
|
73 | 73 | end |
|
74 | ||
|
74 | ||
|
75 | def mock_file | |
|
76 | self.class.mock_file | |
|
77 | end | |
|
78 | ||
|
75 | 79 | # Use a temporary directory for attachment related tests |
|
76 | 80 | def set_tmp_attachments_directory |
|
77 | 81 | Dir.mkdir "#{RAILS_ROOT}/tmp/test" unless File.directory?("#{RAILS_ROOT}/tmp/test") |
General Comments 0
You need to be logged in to leave comments.
Login now