Skip to content

Commit

Permalink
Allowing additional log message when punching out.
Browse files Browse the repository at this point in the history
This goes for single- or all-project punch-outs.
  • Loading branch information
ymendel committed Sep 27, 2008
1 parent b82c96d commit c8e14fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/punch.rb
Expand Up @@ -111,6 +111,7 @@ def log(project, message)
def do_out_single(project, options)
return false if out?(project)
time = options[:time] || Time.now
log(project, options[:message]) if options[:message]
log(project, "punch out @ #{time.strftime('%Y-%m-%dT%H:%M:%S%z')}")
data[project].last['out'] = time
end
Expand Down
15 changes: 15 additions & 0 deletions spec/punch_spec.rb
Expand Up @@ -477,6 +477,13 @@ class << self
Punch.out(@project, :time => time)
end

it 'should log an additional message if given' do
Punch.stubs(:log) # for the time-based message
message = 'finished working on some stuff'
Punch.expects(:log).with(@project, message)
Punch.out(@project, :message => message)
end

it 'should return true' do
Punch.out(@project).should == true
end
Expand Down Expand Up @@ -523,6 +530,14 @@ class << self
Punch.out(:time => time)
end

it 'should log an additional message if given' do
Punch.stubs(:log) # for the time-based messages
message = 'finished working on some stuff'
Punch.expects(:log).with(@projects[1], message)
Punch.expects(:log).with(@projects[2], message)
Punch.out(:message => message)
end

it 'should return true' do
Punch.out.should == true
end
Expand Down

0 comments on commit c8e14fd

Please sign in to comment.