annotate .svn/pristine/89/89376c290028f30b4ca90dbad9cc014c865b1ffd.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

Fix failure to interpret Javascript when autocompleting members for project
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 11 Sep 2014 10:24:38 +0100
parents dffacf8a6908
children
rev   line source
Chris@1517 1 # Redmine - project management software
Chris@1517 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
Chris@1517 3 #
Chris@1517 4 # This program is free software; you can redistribute it and/or
Chris@1517 5 # modify it under the terms of the GNU General Public License
Chris@1517 6 # as published by the Free Software Foundation; either version 2
Chris@1517 7 # of the License, or (at your option) any later version.
Chris@1517 8 #
Chris@1517 9 # This program is distributed in the hope that it will be useful,
Chris@1517 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1517 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1517 12 # GNU General Public License for more details.
Chris@1517 13 #
Chris@1517 14 # You should have received a copy of the GNU General Public License
Chris@1517 15 # along with this program; if not, write to the Free Software
Chris@1517 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@1517 17
Chris@1517 18 require File.expand_path('../../test_helper', __FILE__)
Chris@1517 19
Chris@1517 20 class ActivitiesControllerTest < ActionController::TestCase
Chris@1517 21 fixtures :projects, :trackers, :issue_statuses, :issues,
Chris@1517 22 :enumerations, :users, :issue_categories,
Chris@1517 23 :projects_trackers,
Chris@1517 24 :roles,
Chris@1517 25 :member_roles,
Chris@1517 26 :members,
Chris@1517 27 :groups_users,
Chris@1517 28 :enabled_modules,
Chris@1517 29 :journals, :journal_details
Chris@1517 30
Chris@1517 31
Chris@1517 32 def test_project_index
Chris@1517 33 get :index, :id => 1, :with_subprojects => 0
Chris@1517 34 assert_response :success
Chris@1517 35 assert_template 'index'
Chris@1517 36 assert_not_nil assigns(:events_by_day)
Chris@1517 37
Chris@1517 38 assert_select 'h3', :text => /#{2.days.ago.to_date.day}/
Chris@1517 39 assert_select 'dl dt.issue-edit a', :text => /(#{IssueStatus.find(2).name})/
Chris@1517 40 end
Chris@1517 41
Chris@1517 42 def test_project_index_with_invalid_project_id_should_respond_404
Chris@1517 43 get :index, :id => 299
Chris@1517 44 assert_response 404
Chris@1517 45 end
Chris@1517 46
Chris@1517 47 def test_previous_project_index
Chris@1517 48 get :index, :id => 1, :from => 2.days.ago.to_date
Chris@1517 49 assert_response :success
Chris@1517 50 assert_template 'index'
Chris@1517 51 assert_not_nil assigns(:events_by_day)
Chris@1517 52
Chris@1517 53 assert_select 'h3', :text => /#{3.days.ago.to_date.day}/
Chris@1517 54 assert_select 'dl dt.issue a', :text => /#{ESCAPED_UCANT} print recipes/
Chris@1517 55 end
Chris@1517 56
Chris@1517 57 def test_global_index
Chris@1517 58 @request.session[:user_id] = 1
Chris@1517 59 get :index
Chris@1517 60 assert_response :success
Chris@1517 61 assert_template 'index'
Chris@1517 62 assert_not_nil assigns(:events_by_day)
Chris@1517 63
Chris@1517 64 i5 = Issue.find(5)
Chris@1517 65 d5 = User.find(1).time_to_date(i5.created_on)
Chris@1517 66
Chris@1517 67 assert_select 'h3', :text => /#{d5.day}/
Chris@1517 68 assert_select 'dl dt.issue a', :text => /Subproject issue/
Chris@1517 69 end
Chris@1517 70
Chris@1517 71 def test_user_index
Chris@1517 72 @request.session[:user_id] = 1
Chris@1517 73 get :index, :user_id => 2
Chris@1517 74 assert_response :success
Chris@1517 75 assert_template 'index'
Chris@1517 76 assert_not_nil assigns(:events_by_day)
Chris@1517 77
Chris@1517 78 assert_select 'h2 a[href=/users/2]', :text => 'John Smith'
Chris@1517 79
Chris@1517 80 i1 = Issue.find(1)
Chris@1517 81 d1 = User.find(1).time_to_date(i1.created_on)
Chris@1517 82
Chris@1517 83 assert_select 'h3', :text => /#{d1.day}/
Chris@1517 84 assert_select 'dl dt.issue a', :text => /#{ESCAPED_UCANT} print recipes/
Chris@1517 85 end
Chris@1517 86
Chris@1517 87 def test_user_index_with_invalid_user_id_should_respond_404
Chris@1517 88 get :index, :user_id => 299
Chris@1517 89 assert_response 404
Chris@1517 90 end
Chris@1517 91
Chris@1517 92 def test_index_atom_feed
Chris@1517 93 get :index, :format => 'atom', :with_subprojects => 0
Chris@1517 94 assert_response :success
Chris@1517 95 assert_template 'common/feed'
Chris@1517 96
Chris@1517 97 assert_select 'feed' do
Chris@1517 98 assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?with_subprojects=0'
Chris@1517 99 assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?with_subprojects=0'
Chris@1517 100 assert_select 'entry' do
Chris@1517 101 assert_select 'link[href=?]', 'http://test.host/issues/11'
Chris@1517 102 end
Chris@1517 103 end
Chris@1517 104 end
Chris@1517 105
Chris@1517 106 def test_index_atom_feed_with_explicit_selection
Chris@1517 107 get :index, :format => 'atom', :with_subprojects => 0,
Chris@1517 108 :show_changesets => 1,
Chris@1517 109 :show_documents => 1,
Chris@1517 110 :show_files => 1,
Chris@1517 111 :show_issues => 1,
Chris@1517 112 :show_messages => 1,
Chris@1517 113 :show_news => 1,
Chris@1517 114 :show_time_entries => 1,
Chris@1517 115 :show_wiki_edits => 1
Chris@1517 116
Chris@1517 117 assert_response :success
Chris@1517 118 assert_template 'common/feed'
Chris@1517 119
Chris@1517 120 assert_select 'feed' do
Chris@1517 121 assert_select 'link[rel=self][href=?]', 'http://test.host/activity.atom?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'
Chris@1517 122 assert_select 'link[rel=alternate][href=?]', 'http://test.host/activity?show_changesets=1&amp;show_documents=1&amp;show_files=1&amp;show_issues=1&amp;show_messages=1&amp;show_news=1&amp;show_time_entries=1&amp;show_wiki_edits=1&amp;with_subprojects=0'
Chris@1517 123 assert_select 'entry' do
Chris@1517 124 assert_select 'link[href=?]', 'http://test.host/issues/11'
Chris@1517 125 end
Chris@1517 126 end
Chris@1517 127 end
Chris@1517 128
Chris@1517 129 def test_index_atom_feed_with_one_item_type
Chris@1517 130 get :index, :format => 'atom', :show_issues => '1'
Chris@1517 131 assert_response :success
Chris@1517 132 assert_template 'common/feed'
Chris@1517 133
Chris@1517 134 assert_select 'title', :text => /Issues/
Chris@1517 135 end
Chris@1517 136
Chris@1517 137 def test_index_should_show_private_notes_with_permission_only
Chris@1517 138 journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Private notes with searchkeyword', :private_notes => true)
Chris@1517 139 @request.session[:user_id] = 2
Chris@1517 140
Chris@1517 141 get :index
Chris@1517 142 assert_response :success
Chris@1517 143 assert_include journal, assigns(:events_by_day).values.flatten
Chris@1517 144
Chris@1517 145 Role.find(1).remove_permission! :view_private_notes
Chris@1517 146 get :index
Chris@1517 147 assert_response :success
Chris@1517 148 assert_not_include journal, assigns(:events_by_day).values.flatten
Chris@1517 149 end
Chris@1517 150 end