From 9b579de9e234e378fb5081d79bea02d175495db7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 22 Jul 2008 17:55:19 +0000 Subject: 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 --- test/functional/attachments_controller_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') 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 -- cgit v1.2.3