one_inch_punch 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.3.1 2008-04-06
2
+
3
+ * 1 tiny bugfix enhancement:
4
+ * Total no longer erroring on non-existent parent project
5
+
1
6
  == 0.3.0 2008-04-05
2
7
 
3
8
  * 1 minor enhancement:
data/lib/punch.rb CHANGED
@@ -154,6 +154,7 @@ class Punch
154
154
  end
155
155
 
156
156
  def do_total_time(list_data, options)
157
+ return nil unless list_data
157
158
  total = list_data.collect { |t| ((t['out'] || Time.now) - t['in']).to_i }.inject(0) { |sum, t| sum + t }
158
159
  return total unless options[:format]
159
160
  total.elapsed_time
data/lib/punch/version.rb CHANGED
@@ -2,7 +2,7 @@ class Punch
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/spec/punch_spec.rb CHANGED
@@ -1145,7 +1145,29 @@ describe Punch do
1145
1145
  Punch.total(@projects['parent'], :after => @now - 21).should == total_data
1146
1146
  end
1147
1147
 
1148
- describe 'when do project is given' do
1148
+ it 'should handle a non-existent parent project' do
1149
+ @data.delete(@projects['parent'])
1150
+ Punch.data = @data
1151
+ total_data = { @projects['parent'] => nil, @projects['child'] => 10 }
1152
+ Punch.total(@projects['parent']).should == total_data
1153
+ end
1154
+
1155
+ it 'should handle an empty parent project' do
1156
+ @data[@projects['parent']] = []
1157
+ Punch.data = @data
1158
+ total_data = { @projects['parent'] => 0, @projects['child'] => 10 }
1159
+ Punch.total(@projects['parent']).should == total_data
1160
+ end
1161
+
1162
+ it 'should handle an empty child project' do
1163
+ @projects['other_child'] = @projects['parent'] + '/button'
1164
+ @data[@projects['other_child']] = []
1165
+ Punch.data = @data
1166
+ total_data = { @projects['parent'] => 50, @projects['child'] => 10, @projects['other_child'] => 0 }
1167
+ Punch.total(@projects['parent']).should == total_data
1168
+ end
1169
+
1170
+ describe 'when no project is given' do
1149
1171
  before do
1150
1172
  @extra_projects = ['test project', 'out project', 'other project']
1151
1173
  @data[@extra_projects[0]] = [ {'in' => @now - 50, 'out' => @now - 25} ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: one_inch_punch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yossef Mendelssohn
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-05 00:00:00 -05:00
12
+ date: 2009-04-06 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency