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.

wikis_controller_test.rb 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # frozen_string_literal: true
  2. # Redmine - project management software
  3. # Copyright (C) 2006-2023 Jean-Philippe Lang
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. require_relative '../test_helper'
  19. class WikisControllerTest < Redmine::ControllerTest
  20. fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis
  21. def setup
  22. User.current = nil
  23. end
  24. def test_get_destroy_should_ask_confirmation
  25. set_tmp_attachments_directory
  26. @request.session[:user_id] = 1
  27. assert_no_difference 'Wiki.count' do
  28. get :destroy, :params => {:id => 1}
  29. assert_response :success
  30. end
  31. end
  32. def test_post_destroy_should_delete_wiki
  33. set_tmp_attachments_directory
  34. @request.session[:user_id] = 1
  35. post :destroy, :params => {:id => 1, :confirm => 1}
  36. assert_redirected_to :controller => 'projects',
  37. :action => 'show', :id => 'ecookbook'
  38. assert_nil Project.find(1).wiki
  39. end
  40. def test_not_found
  41. @request.session[:user_id] = 1
  42. post :destroy, :params => {:id => 999, :confirm => 1}
  43. assert_response 404
  44. end
  45. end