annotate .svn/pristine/fd/fd2af2af9c6909013320cc2122eda3dd4725d271.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 IssueCategoryTest < ActiveSupport::TestCase
Chris@1517 21 fixtures :issue_categories, :issues, :users, :groups_users
Chris@1517 22
Chris@1517 23 def setup
Chris@1517 24 @category = IssueCategory.find(1)
Chris@1517 25 end
Chris@1517 26
Chris@1517 27 def test_create
Chris@1517 28 assert IssueCategory.new(:project_id => 2, :name => 'New category').save
Chris@1517 29 category = IssueCategory.order('id DESC').first
Chris@1517 30 assert_equal 'New category', category.name
Chris@1517 31 end
Chris@1517 32
Chris@1517 33 def test_create_with_group_assignment
Chris@1517 34 assert IssueCategory.new(:project_id => 2, :name => 'Group assignment', :assigned_to_id => 11).save
Chris@1517 35 category = IssueCategory.order('id DESC').first
Chris@1517 36 assert_kind_of Group, category.assigned_to
Chris@1517 37 assert_equal Group.find(11), category.assigned_to
Chris@1517 38 end
Chris@1517 39
Chris@1517 40 def test_destroy
Chris@1517 41 issue = @category.issues.first
Chris@1517 42 @category.destroy
Chris@1517 43 # Make sure the category was nullified on the issue
Chris@1517 44 assert_nil issue.reload.category
Chris@1517 45 end
Chris@1517 46
Chris@1517 47 def test_destroy_with_reassign
Chris@1517 48 issue = @category.issues.first
Chris@1517 49 reassign_to = IssueCategory.find(2)
Chris@1517 50 @category.destroy(reassign_to)
Chris@1517 51 # Make sure the issue was reassigned
Chris@1517 52 assert_equal reassign_to, issue.reload.category
Chris@1517 53 end
Chris@1517 54 end