summaryrefslogtreecommitdiffstats
path: root/test/task_test.rb
diff options
context:
space:
mode:
authorZack Hobson2013-12-22 02:01:37 -0800
committerZack Hobson2013-12-22 02:01:37 -0800
commit24bb1cc3fea3e75aedcc64cdc30bb73089a7c157 (patch)
tree9a57f2baf979605e349d0856f62fe91d63da2ea4 /test/task_test.rb
parentde34961a1a1795bd12b3cabd47ca06e01c73c27a (diff)
downloadhcl-24bb1cc3fea3e75aedcc64cdc30bb73089a7c157.tar.bz2
coverage game!
Diffstat (limited to 'test/task_test.rb')
-rw-r--r--test/task_test.rb34
1 files changed, 33 insertions, 1 deletions
diff --git a/test/task_test.rb b/test/task_test.rb
index e313f73..f5c30b8 100644
--- a/test/task_test.rb
+++ b/test/task_test.rb
@@ -1,5 +1,37 @@
-class Task < HCl::TestCase
+class TaskTest < HCl::TestCase
+ DAILY_ENTRY = %{<daily>
+ <for_day type="date">Wed, 18 Oct 2006</for_day>
+ <day_entries>
+ <day_entry>
+ <id type="integer">195168</id>
+ <client>Iridesco</client>
+ <project>Harvest</project>
+ <task>Backend Programming</task>
+ <hours type="float">2.06</hours>
+ <notes>Test api support</notes>
+ <timer_started_at type="datetime">
+ Wed, 18 Oct 2006 09:53:06 -0000
+ </timer_started_at>
+ <created_at type="datetime">Wed, 18 Oct 2006 09:53:06 -0000</created_at>
+ </day_entry>
+ </day_entries>
+ </daily>}
+
+ 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)
+ <request>
+ <notes>hi world</notes>
+ <hours>0.5</hours>
+ <project_id type="integer">123</project_id>
+ <task_id type="integer">456</task_id>
+ <spent_at type="date">now</spent_at>
+ </request>
+ 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