annotate test/unit/workflow_test.rb @ 1452:d6b9fd02bb89 feature_36_js_refactoring

Deprecated develoment branch.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 11 Oct 2013 17:01:24 +0100
parents 0c939c159af4
children cbb26bc654de
rev   line source
Chris@507 1 # Redmine - project management software
Chris@507 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
Chris@507 3 #
Chris@507 4 # This program is free software; you can redistribute it and/or
Chris@507 5 # modify it under the terms of the GNU General Public License
Chris@507 6 # as published by the Free Software Foundation; either version 2
Chris@507 7 # of the License, or (at your option) any later version.
Chris@507 8 #
Chris@507 9 # This program is distributed in the hope that it will be useful,
Chris@507 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@507 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@507 12 # GNU General Public License for more details.
Chris@507 13 #
Chris@507 14 # You should have received a copy of the GNU General Public License
Chris@507 15 # along with this program; if not, write to the Free Software
Chris@507 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@507 17
Chris@507 18 require File.expand_path('../../test_helper', __FILE__)
Chris@507 19
Chris@507 20 class WorkflowTest < ActiveSupport::TestCase
Chris@507 21 fixtures :roles, :trackers, :issue_statuses
Chris@507 22
Chris@507 23 def test_copy
Chris@507 24 Workflow.delete_all
Chris@507 25 Workflow.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 1, :new_status_id => 2)
Chris@507 26 Workflow.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 1, :new_status_id => 3, :assignee => true)
Chris@507 27 Workflow.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 1, :new_status_id => 4, :author => true)
Chris@507 28
Chris@507 29 assert_difference 'Workflow.count', 3 do
Chris@507 30 Workflow.copy(Tracker.find(2), Role.find(1), Tracker.find(3), Role.find(2))
Chris@507 31 end
Chris@507 32
Chris@507 33 assert Workflow.first(:conditions => {:role_id => 2, :tracker_id => 3, :old_status_id => 1, :new_status_id => 2, :author => false, :assignee => false})
Chris@507 34 assert Workflow.first(:conditions => {:role_id => 2, :tracker_id => 3, :old_status_id => 1, :new_status_id => 3, :author => false, :assignee => true})
Chris@507 35 assert Workflow.first(:conditions => {:role_id => 2, :tracker_id => 3, :old_status_id => 1, :new_status_id => 4, :author => true, :assignee => false})
Chris@507 36 end
Chris@507 37 end