Mercurial > hg > soundsoftware-site
comparison test/functional/my_controller_test.rb @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children | e248c7af89ec |
comparison
equal
deleted
inserted
replaced
1297:0a574315af3e | 1298:4f746d8966dd |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2013 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
14 # You should have received a copy of the GNU General Public License | 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 | 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. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.expand_path('../../test_helper', __FILE__) | 18 require File.expand_path('../../test_helper', __FILE__) |
19 require 'my_controller' | |
20 | |
21 # Re-raise errors caught by the controller. | |
22 class MyController; def rescue_action(e) raise e end; end | |
23 | 19 |
24 class MyControllerTest < ActionController::TestCase | 20 class MyControllerTest < ActionController::TestCase |
25 fixtures :users, :user_preferences, :roles, :projects, :members, :member_roles, | 21 fixtures :users, :user_preferences, :roles, :projects, :members, :member_roles, |
26 :issues, :issue_statuses, :trackers, :enumerations, :custom_fields, :auth_sources | 22 :issues, :issue_statuses, :trackers, :enumerations, :custom_fields, :auth_sources |
27 | 23 |
28 def setup | 24 def setup |
29 @controller = MyController.new | |
30 @request = ActionController::TestRequest.new | |
31 @request.session[:user_id] = 2 | 25 @request.session[:user_id] = 2 |
32 @response = ActionController::TestResponse.new | |
33 end | 26 end |
34 | 27 |
35 def test_index | 28 def test_index |
36 get :index | 29 get :index |
37 assert_response :success | 30 assert_response :success |
54 assert_response :success | 47 assert_response :success |
55 assert_select 'tr.time-entry' do | 48 assert_select 'tr.time-entry' do |
56 assert_select 'td.subject a[href=/issues/1]' | 49 assert_select 'td.subject a[href=/issues/1]' |
57 assert_select 'td.hours', :text => '2.50' | 50 assert_select 'td.hours', :text => '2.50' |
58 end | 51 end |
52 end | |
53 | |
54 def test_page_with_all_blocks | |
55 blocks = MyController::BLOCKS.keys | |
56 preferences = User.find(2).pref | |
57 preferences[:my_page_layout] = {'top' => blocks} | |
58 preferences.save! | |
59 | |
60 get :page | |
61 assert_response :success | |
62 assert_select 'div.mypage-box', blocks.size | |
59 end | 63 end |
60 | 64 |
61 def test_my_account_should_show_editable_custom_fields | 65 def test_my_account_should_show_editable_custom_fields |
62 get :account | 66 get :account |
63 assert_response :success | 67 assert_response :success |