summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-22 17:55:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-22 17:55:19 +0000
commit9b579de9e234e378fb5081d79bea02d175495db7 (patch)
tree28d55b59b2ade9201dd0ea518c56e740b039e649 /test
parent8a7bfc72b20a0a554812db7f8bb7bfdf3e2a21d4 (diff)
downloadredmine-9b579de9e234e378fb5081d79bea02d175495db7.tar.gz
redmine-9b579de9e234e378fb5081d79bea02d175495db7.zip
Appends the filename to the attachment url so that clients that ignore content-disposition http header get the real filename (#1649).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1686 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/attachments_controller_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index af73eb77e..06a6343ba 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -33,6 +33,21 @@ class AttachmentsControllerTest < Test::Unit::TestCase
User.current = nil
end
+ def test_routing
+ assert_routing('/attachments/1', :controller => 'attachments', :action => 'show', :id => '1')
+ assert_routing('/attachments/1/filename.ext', :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext')
+ assert_routing('/attachments/download/1', :controller => 'attachments', :action => 'download', :id => '1')
+ assert_routing('/attachments/download/1/filename.ext', :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext')
+ end
+
+ def test_recognizes
+ assert_recognizes({:controller => 'attachments', :action => 'show', :id => '1'}, '/attachments/1')
+ assert_recognizes({:controller => 'attachments', :action => 'show', :id => '1'}, '/attachments/show/1')
+ assert_recognizes({:controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'}, '/attachments/1/filename.ext')
+ assert_recognizes({:controller => 'attachments', :action => 'download', :id => '1'}, '/attachments/download/1')
+ assert_recognizes({:controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'},'/attachments/download/1/filename.ext')
+ end
+
def test_show_diff
get :show, :id => 5
assert_response :success