To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / test / unit / tracker_test.rb @ 441:cbce1fd3b1b7
History | View | Annotate | Download (1.79 KB)
| 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.expand_path('../../test_helper', __FILE__) |
| 19 |
|
| 20 |
class TrackerTest < ActiveSupport::TestCase |
| 21 |
fixtures :trackers, :workflows, :issue_statuses, :roles |
| 22 |
|
| 23 |
def test_copy_workflows |
| 24 |
source = Tracker.find(1) |
| 25 |
assert_equal 89, source.workflows.size
|
| 26 |
|
| 27 |
target = Tracker.new(:name => 'Target') |
| 28 |
assert target.save |
| 29 |
target.workflows.copy(source) |
| 30 |
target.reload |
| 31 |
assert_equal 89, target.workflows.size
|
| 32 |
end
|
| 33 |
|
| 34 |
def test_issue_statuses |
| 35 |
tracker = Tracker.find(1) |
| 36 |
Workflow.delete_all
|
| 37 |
Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 2, :new_status_id => 3) |
| 38 |
Workflow.create!(:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 5) |
| 39 |
|
| 40 |
assert_kind_of Array, tracker.issue_statuses
|
| 41 |
assert_kind_of IssueStatus, tracker.issue_statuses.first
|
| 42 |
assert_equal [2, 3, 5], Tracker.find(1).issue_statuses.collect(&:id) |
| 43 |
end
|
| 44 |
|
| 45 |
def test_issue_statuses_empty |
| 46 |
Workflow.delete_all("tracker_id = 1") |
| 47 |
assert_equal [], Tracker.find(1).issue_statuses |
| 48 |
end
|
| 49 |
end
|