Mercurial > hg > soundsoftware-site
comparison test/functional/.svn/text-base/journals_controller_test.rb.svn-base @ 0:513646585e45
* Import Redmine trunk SVN rev 3859
author | Chris Cannam |
---|---|
date | Fri, 23 Jul 2010 15:52:44 +0100 |
parents | |
children | 1d32c0a0efbf |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:513646585e45 |
---|---|
1 # redMine - project management software | |
2 # Copyright (C) 2006-2008 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 | |
18 require File.dirname(__FILE__) + '/../test_helper' | |
19 require 'journals_controller' | |
20 | |
21 # Re-raise errors caught by the controller. | |
22 class JournalsController; def rescue_action(e) raise e end; end | |
23 | |
24 class JournalsControllerTest < ActionController::TestCase | |
25 fixtures :projects, :users, :members, :member_roles, :roles, :issues, :journals, :journal_details, :enabled_modules | |
26 | |
27 def setup | |
28 @controller = JournalsController.new | |
29 @request = ActionController::TestRequest.new | |
30 @response = ActionController::TestResponse.new | |
31 User.current = nil | |
32 end | |
33 | |
34 def test_get_edit | |
35 @request.session[:user_id] = 1 | |
36 xhr :get, :edit, :id => 2 | |
37 assert_response :success | |
38 assert_select_rjs :insert, :after, 'journal-2-notes' do | |
39 assert_select 'form[id=journal-2-form]' | |
40 assert_select 'textarea' | |
41 end | |
42 end | |
43 | |
44 def test_post_edit | |
45 @request.session[:user_id] = 1 | |
46 xhr :post, :edit, :id => 2, :notes => 'Updated notes' | |
47 assert_response :success | |
48 assert_select_rjs :replace, 'journal-2-notes' | |
49 assert_equal 'Updated notes', Journal.find(2).notes | |
50 end | |
51 | |
52 def test_post_edit_with_empty_notes | |
53 @request.session[:user_id] = 1 | |
54 xhr :post, :edit, :id => 2, :notes => '' | |
55 assert_response :success | |
56 assert_select_rjs :remove, 'change-2' | |
57 assert_nil Journal.find_by_id(2) | |
58 end | |
59 end |