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.

messages_controller_test.rb 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 'messages_controller'
  19. # Re-raise errors caught by the controller.
  20. class MessagesController; def rescue_action(e) raise e end; end
  21. class MessagesControllerTest < Test::Unit::TestCase
  22. fixtures :projects, :users, :members, :roles, :boards, :messages, :enabled_modules
  23. def setup
  24. @controller = MessagesController.new
  25. @request = ActionController::TestRequest.new
  26. @response = ActionController::TestResponse.new
  27. User.current = nil
  28. end
  29. def test_show
  30. get :show, :board_id => 1, :id => 1
  31. assert_response :success
  32. assert_template 'show'
  33. assert_not_nil assigns(:board)
  34. assert_not_nil assigns(:project)
  35. assert_not_nil assigns(:topic)
  36. end
  37. def test_reply
  38. @request.session[:user_id] = 2
  39. post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' }
  40. assert_redirected_to 'messages/show'
  41. assert Message.find_by_subject('Test reply')
  42. end
  43. end