You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

issues_controller_test.rb 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # redMine - project management software
  2. # Copyright (C) 2006-2007 Jean-Philippe Lang
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 2
  7. # of the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. require File.dirname(__FILE__) + '/../test_helper'
  18. require 'issues_controller'
  19. # Re-raise errors caught by the controller.
  20. class IssuesController; def rescue_action(e) raise e end; end
  21. class IssuesControllerTest < Test::Unit::TestCase
  22. fixtures :projects, :users, :roles, :members, :issues, :enabled_modules, :enumerations
  23. def setup
  24. @controller = IssuesController.new
  25. @request = ActionController::TestRequest.new
  26. @response = ActionController::TestResponse.new
  27. User.current = nil
  28. end
  29. def test_index
  30. get :index
  31. assert_response :success
  32. assert_template 'index.rhtml'
  33. assert_not_nil assigns(:issues)
  34. assert_nil assigns(:project)
  35. end
  36. def test_index_with_project
  37. get :index, :project_id => 1
  38. assert_response :success
  39. assert_template 'index.rhtml'
  40. assert_not_nil assigns(:issues)
  41. end
  42. def test_index_with_project_and_filter
  43. get :index, :project_id => 1, :set_filter => 1
  44. assert_response :success
  45. assert_template 'index.rhtml'
  46. assert_not_nil assigns(:issues)
  47. end
  48. def test_index_csv_with_project
  49. get :index, :format => 'csv'
  50. assert_response :success
  51. assert_not_nil assigns(:issues)
  52. assert_equal 'text/csv', @response.content_type
  53. get :index, :project_id => 1, :format => 'csv'
  54. assert_response :success
  55. assert_not_nil assigns(:issues)
  56. assert_equal 'text/csv', @response.content_type
  57. end
  58. def test_index_pdf
  59. get :index, :format => 'pdf'
  60. assert_response :success
  61. assert_not_nil assigns(:issues)
  62. assert_equal 'application/pdf', @response.content_type
  63. get :index, :project_id => 1, :format => 'pdf'
  64. assert_response :success
  65. assert_not_nil assigns(:issues)
  66. assert_equal 'application/pdf', @response.content_type
  67. end
  68. def test_changes
  69. get :changes, :project_id => 1
  70. assert_response :success
  71. assert_not_nil assigns(:changes)
  72. assert_equal 'application/atom+xml', @response.content_type
  73. end
  74. end