您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

wikis_controller_test.rb 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Redmine - project management software
  2. # Copyright (C) 2006-2017 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.expand_path('../../test_helper', __FILE__)
  18. class WikisControllerTest < Redmine::ControllerTest
  19. fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis
  20. def setup
  21. User.current = nil
  22. end
  23. def test_get_destroy_should_ask_confirmation
  24. @request.session[:user_id] = 1
  25. assert_no_difference 'Wiki.count' do
  26. get :destroy, :params => {:id => 1}
  27. assert_response :success
  28. end
  29. end
  30. def test_post_destroy_should_delete_wiki
  31. @request.session[:user_id] = 1
  32. post :destroy, :params => {:id => 1, :confirm => 1}
  33. assert_redirected_to :controller => 'projects',
  34. :action => 'settings', :id => 'ecookbook', :tab => 'wiki'
  35. assert_nil Project.find(1).wiki
  36. end
  37. def test_not_found
  38. @request.session[:user_id] = 1
  39. post :destroy, :params => {:id => 999, :confirm => 1}
  40. assert_response 404
  41. end
  42. end