From 873325ebce6d0451263d115a8f02f40e0a6fbd40 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 27 Jan 2018 00:31:57 +0100 Subject: Add date argument to `log` command Adds an optional date argument to the `log` command that can be specified just before the task alias. Some examples from @skoppelmanCC: hcl log yesterday @documentation +2 Ran spellcheck hcl log 3 days ago @wireframes +3.5 hcl log last friday @admin +1 filed timesheets Commands#log: Copy over the contents of `Commands#start` and replace `task.start` with `task.add`. This allows us to log the time without actually starting a timer (and thus having to subsequently stop that timer). command_test.rb(#test_start): Update expected method call arguments with `spent_at`. Now that we're passing in `spent_at`, the expected arguments should include it. command_test.rb(#test_log_failure): Delete this test because I've rewritten the `Commands#log` method to no longer use timers. utility_test.rb: Add tests for `#get_date` Fixes #83. --- test/command_test.rb | 5 ----- 1 file changed, 5 deletions(-) (limited to 'test/command_test.rb') diff --git a/test/command_test.rb b/test/command_test.rb index 8536286..94ff673 100644 --- a/test/command_test.rb +++ b/test/command_test.rb @@ -31,11 +31,6 @@ class CommandTest < HCl::TestCase assert_equal "taco.time: now\n", standard_output end - def test_log_failure - HCl::DayEntry.expects(:with_timer).returns(stub) - assert_raises(HCl::CommandError) { log "stuff" } - end - def test_tasks FileUtils.rm_rf ENV['HCL_DIR']+"/cache" register_uri(:get, '/daily', {:day_entries=>[], :projects=> [{ -- cgit v1.2.3