one_inch_punch 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/lib/punch/version.rb +1 -1
- data/lib/punch.rb +1 -1
- data/spec/punch_spec.rb +38 -1
- metadata +6 -4
data/History.txt
CHANGED
data/lib/punch/version.rb
CHANGED
data/lib/punch.rb
CHANGED
@@ -169,7 +169,7 @@ class Punch
|
|
169
169
|
end
|
170
170
|
|
171
171
|
def child_projects(project)
|
172
|
-
projects.select { |proj| proj.match(/^#{Regexp.escape(project)}
|
172
|
+
projects.select { |proj| proj.match(/^#{Regexp.escape(project)}\//) } - [project]
|
173
173
|
end
|
174
174
|
|
175
175
|
def in_child(project)
|
data/spec/punch_spec.rb
CHANGED
@@ -350,6 +350,15 @@ describe Punch do
|
|
350
350
|
Punch.data = @data
|
351
351
|
Punch.status(@projects['parent'], :full => true).should == { :status => 'out', :time => @now - 5 }
|
352
352
|
end
|
353
|
+
|
354
|
+
it 'should only see projects having the specific parent/child naming as sub-projects' do
|
355
|
+
@data[@projects['parent']] = []
|
356
|
+
non_child = @projects['parent'] + '_other'
|
357
|
+
@data[non_child] = [ { 'in' => @now - 45 } ]
|
358
|
+
Punch.data = @data
|
359
|
+
|
360
|
+
Punch.status(@projects['parent']).should.be.nil
|
361
|
+
end
|
353
362
|
end
|
354
363
|
end
|
355
364
|
|
@@ -821,6 +830,16 @@ describe Punch do
|
|
821
830
|
Punch.out(@projects['parent'])
|
822
831
|
Punch.data[@projects['parent']].should == []
|
823
832
|
end
|
833
|
+
|
834
|
+
it 'should only see projects having the specific parent/child naming as sub-projects' do
|
835
|
+
@data[@projects['parent']] = [ { 'in' => @now - 20 } ]
|
836
|
+
non_child = @projects['parent'] + '_other'
|
837
|
+
@data[non_child] = [ { 'in' => @now - 45 } ]
|
838
|
+
Punch.data = @data
|
839
|
+
|
840
|
+
Punch.out(@projects['parent'])
|
841
|
+
Punch.data[non_child].should == [ { 'in' => @now - 45 } ]
|
842
|
+
end
|
824
843
|
end
|
825
844
|
end
|
826
845
|
|
@@ -994,12 +1013,21 @@ describe Punch do
|
|
994
1013
|
Punch.list(@projects['parent']).should == list_data
|
995
1014
|
end
|
996
1015
|
|
1016
|
+
it 'should only see projects having the specific parent/child naming as sub-projects' do
|
1017
|
+
non_child = @projects['parent'] + '_other'
|
1018
|
+
@data[non_child] = [ { 'in' => @now - 45 } ]
|
1019
|
+
Punch.data = @data
|
1020
|
+
|
1021
|
+
list_data = { @projects['parent'] => @data[@projects['parent']], @projects['child'] => @data[@projects['child']] }
|
1022
|
+
Punch.list(@projects['parent']).should == list_data
|
1023
|
+
end
|
1024
|
+
|
997
1025
|
it 'should respect options' do
|
998
1026
|
list_data = { @projects['parent'] => [], @projects['child'] => @data[@projects['child']] }
|
999
1027
|
Punch.list(@projects['parent'], :after => @now - 21).should == list_data
|
1000
1028
|
end
|
1001
1029
|
|
1002
|
-
describe 'when
|
1030
|
+
describe 'when no project is given' do
|
1003
1031
|
before do
|
1004
1032
|
@projects = ['test project', 'out project', 'other project']
|
1005
1033
|
@data[@projects[0]] = [ {'in' => @now - 50, 'out' => @now - 25} ]
|
@@ -1167,6 +1195,15 @@ describe Punch do
|
|
1167
1195
|
Punch.total(@projects['parent']).should == total_data
|
1168
1196
|
end
|
1169
1197
|
|
1198
|
+
it 'should only see projects having the specific parent/child naming as sub-projects' do
|
1199
|
+
non_child = @projects['parent'] + '_other'
|
1200
|
+
@data[non_child] = [ { 'in' => @now - 45, 'out' => @now - 20 } ]
|
1201
|
+
Punch.data = @data
|
1202
|
+
|
1203
|
+
total_data = { @projects['parent'] => 50, @projects['child'] => 10 }
|
1204
|
+
Punch.total(@projects['parent']).should == total_data
|
1205
|
+
end
|
1206
|
+
|
1170
1207
|
describe 'when no project is given' do
|
1171
1208
|
before do
|
1172
1209
|
@extra_projects = ['test project', 'out project', 'other project']
|
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.
|
4
|
+
version: 0.3.2
|
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-
|
12
|
+
date: 2009-06-01 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -82,6 +82,8 @@ files:
|
|
82
82
|
- tasks/website.rake
|
83
83
|
has_rdoc: true
|
84
84
|
homepage: http://yomendel.rubyforge.org
|
85
|
+
licenses: []
|
86
|
+
|
85
87
|
post_install_message: ""
|
86
88
|
rdoc_options:
|
87
89
|
- --main
|
@@ -103,9 +105,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
105
|
requirements: []
|
104
106
|
|
105
107
|
rubyforge_project: yomendel
|
106
|
-
rubygems_version: 1.3.
|
108
|
+
rubygems_version: 1.3.3
|
107
109
|
signing_key:
|
108
|
-
specification_version:
|
110
|
+
specification_version: 3
|
109
111
|
summary: a simple time-tracking tool
|
110
112
|
test_files: []
|
111
113
|
|