diff options
| -rw-r--r-- | CHANGELOG | 1 | ||||
| -rw-r--r-- | lib/hcl/commands.rb | 1 | ||||
| -rw-r--r-- | lib/hcl/utility.rb | 4 | ||||
| -rw-r--r-- | test/command_test.rb | 5 |
4 files changed, 9 insertions, 2 deletions
@@ -3,6 +3,7 @@ == next * MacOS X: store password in default keychain +* abort log command when a timer is running == v0.4.8 2013-11-30 diff --git a/lib/hcl/commands.rb b/lib/hcl/commands.rb index da3b1f0..a725ad4 100644 --- a/lib/hcl/commands.rb +++ b/lib/hcl/commands.rb @@ -88,6 +88,7 @@ module HCl end def log *args + fail "There is already a timer running." if DayEntry.with_timer start *args stop end diff --git a/lib/hcl/utility.rb b/lib/hcl/utility.rb index 72b4842..fd01901 100644 --- a/lib/hcl/utility.rb +++ b/lib/hcl/utility.rb @@ -1,8 +1,8 @@ module HCl class CommandError < StandardError; end module Utility - def fail message - raise CommandError, message + def fail *message + raise CommandError, message.join(' ') end def get_task_ids ident, args diff --git a/test/command_test.rb b/test/command_test.rb index b554bfd..dd6f440 100644 --- a/test/command_test.rb +++ b/test/command_test.rb @@ -18,6 +18,11 @@ class CommandTest < HCl::TestCase @settings end + def test_log_failure + HCl::DayEntry.expects(:with_timer).returns(stub) + assert_raises(HCl::CommandError) { log "stuff" } + end + def test_tasks HCl::Task.expects(:all).returns([HCl::Task.new( id:123, |
