Permalink
Browse files

Adding 'clock' to command-line

Thought momentarily about putting in extra code merely so I could have a
line in the hash assignment reading `'clock' => 'entry'`, but quickly
got a hold of myself.
  • Loading branch information...
1 parent 54ff639 commit 1d865ebcf735f34d73766bc894ac26d07b98e5d1 @ymendel committed Apr 10, 2012
Showing with 17 additions and 0 deletions.
  1. +1 −0 bin/punch
  2. +16 −0 spec/punch_command_spec.rb
View
@@ -151,6 +151,7 @@ commands = {
end
end
}
+commands['clock'] = commands['entry']
if command_code = commands[command]
command_code.call(project)
View
@@ -570,6 +570,22 @@ def run_command(*args)
run_command('entry')
end
end
+
+ it "should have 'clock' as an alias" do
+ from_option = '2012-04-10 14:39'
+ from_time = Time.local(2012, 4, 10, 14, 39)
+ to_option = '2012-04-10 17:43'
+ to_time = Time.local(2012, 4, 10, 17, 43)
+
+ Punch.should.receive(:entry) do |proj, options|
+ proj.should == @project
+ options[:from].should == from_time
+ options[:to ].should == to_time
+ end
+
+ run_command('clock', @project, '--from', from_option, '--to', to_option)
+ end
+
end
describe "when the command is 'delete'" do

0 comments on commit 1d865eb

Please sign in to comment.