summaryrefslogtreecommitdiffstats
path: root/test/functional/attachments_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/attachments_controller_test.rb')
-rw-r--r--test/functional/attachments_controller_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index ac66a6454..82b0d0cf0 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -223,12 +223,21 @@ class AttachmentsControllerTest < ActionController::TestCase
set_tmp_attachments_directory
end
- def test_show_file_without_container_should_be_denied
+ def test_show_file_without_container_should_be_allowed_to_author
set_tmp_attachments_directory
attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
@request.session[:user_id] = 2
get :show, :id => attachment.id
+ assert_response 200
+ end
+
+ def test_show_file_without_container_should_be_allowed_to_author
+ set_tmp_attachments_directory
+ attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
+
+ @request.session[:user_id] = 3
+ get :show, :id => attachment.id
assert_response 403
end