summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/attachment_test.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb
index a038042cb..c9100f3d0 100644
--- a/test/unit/attachment_test.rb
+++ b/test/unit/attachment_test.rb
@@ -22,10 +22,10 @@ require File.expand_path('../../test_helper', __FILE__)
class AttachmentTest < ActiveSupport::TestCase
fixtures :users, :projects, :roles, :members, :member_roles,
:enabled_modules, :issues, :trackers, :attachments
-
+
class MockFile
attr_reader :original_filename, :content_type, :content, :size
-
+
def initialize(attributes)
@original_filename = attributes[:original_filename]
@content_type = attributes[:content_type]
@@ -153,12 +153,12 @@ class AttachmentTest < ActiveSupport::TestCase
:author => User.find(1))
assert a1.disk_filename != a2.disk_filename
end
-
+
def test_filename_should_be_basenamed
a = Attachment.new(:file => MockFile.new(:original_filename => "path/to/the/file"))
assert_equal 'file', a.filename
end
-
+
def test_filename_should_be_sanitized
a = Attachment.new(:file => MockFile.new(:original_filename => "valid:[] invalid:?%*|\"'<>chars"))
assert_equal 'valid_[] invalid_chars', a.filename