class TaskTest < HCl::TestCase
DAILY_ENTRY = %{
Wed, 18 Oct 2006
195168
Iridesco
Harvest
Backend Programming
2.06
Test api support
Wed, 18 Oct 2006 09:53:06 -0000
Wed, 18 Oct 2006 09:53:06 -0000
}
def test_add_task
task = HCl::Task.new(id:456, project:HCl::Project.new(id:123))
Date.expects(:today).returns('now')
HCl::Task.expects(:post).with('daily/add', <<-EOT).returns(DAILY_ENTRY)
hi world
0.5
123
456
now
EOT
task.add note:'hi world', starting_time:0.5
end
def test_cache_file
assert_equal "#{HCl::App::HCL_DIR}/cache/tasks.yml", HCl::Task.cache_file
end
def test_cache_tasks
HCl::Task.cache_tasks(REXML::Document.new(<<-EOD))
Click and Type
3
AFS
Security support
14
true
EOD
assert_equal 1, HCl::Task.all.size
assert_equal 'Security support', HCl::Task.all.first.name
end
end