Sha256: 8e1315aa73382991dad05bab727cd880794dc6afcdd5dac3963e0e7823ca79b4
Contents?: true
Size: 1.76 KB
Versions: 13
Compression:
Stored size: 1.76 KB
Contents
require File.dirname(__FILE__) + '/../test_helper' class TaskTest < Test::Unit::TestCase include UserSystem main_scenario def setup self.current_user = User.find(1000001) end def teardown self.current_user = nil end def test_two_started_tasks tasks(:first).start_work tasks(:another).start_work end def test_two_started_tasks_anonymous self.current_user = nil tasks(:first).start_work tasks(:another).start_work end def test_move_task_to_period before = Task.find(tasks(:another).id) period = periods(:future) before.move_to_period period check_move_effects(before, :future) end def test_move_task_to_period_subtask before = Task.find(tasks(:subsubtask).id) period = periods(:future) before.move_to_period period check_move_effects(before, :future) end private def check_move_effects(before, period_sym) after = Task.find(before.id) assert_equal before.period_id, after.period_id assert_equal Task::POSTPONED, after.resolution assert_not_nil after.finished_at newest_task = Task.find(:first, :order => 'id DESC') new_task = Task.find_descendant(periods(period_sym).id, before.id) assert_not_nil newest_task assert_not_nil new_task assert_equal newest_task.id, new_task.id assert_equal before.previous_task_id || before.id, new_task.previous_task_id assert_nil new_task.finished_at assert_nil new_task.resolution assert_equal 1, new_task.position while before.parent before = before.parent new_parent_task = Task.find_descendant(periods(period_sym).id, before.id) assert new_parent_task assert_equal new_parent_task.id, new_task.parent_id new_task = new_parent_task end end end
Version data entries
13 entries across 13 versions & 1 rubygems