timesheets 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timesheets.rb +7 -1
- data/lib/timesheets/commands/base.rb +5 -1
- data/lib/timesheets/commands/status.rb +2 -2
- data/lib/timesheets/version.rb +1 -1
- data/spec/lib/timesheets/commands/status_spec.rb +25 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b28d192d2b2b71887d1e08d16dca0e4b74ea41e
|
4
|
+
data.tar.gz: e9cf99cdb3d74adccd7c12646bd022a176cb929e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6439beb36e70f770d0429528f77f1b96b0f186e43e98a9808875f5065491811b26db83e81e663bf735da03f4c947a9d4e9b05ad3c7824f2f77b03611f52440e4
|
7
|
+
data.tar.gz: a37b63ef32190967a4e5b73f86a403ca06958840ed894d66f084f17591ac42f35a7d4640add13196786b4c46c5159528db3de28ebc11c13ea0724ba66aff6d94
|
data/lib/timesheets.rb
CHANGED
@@ -8,11 +8,15 @@ module Timesheets
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def initialize(options = {})
|
11
|
-
|
11
|
+
@options = options
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
+
def logger
|
17
|
+
@logger ||= Timesheets::Logger.new
|
18
|
+
end
|
19
|
+
|
16
20
|
def session_in_progress?
|
17
21
|
rows.last.last.nil?
|
18
22
|
end
|
@@ -9,7 +9,7 @@ module Timesheets
|
|
9
9
|
strings << "Not currently working."
|
10
10
|
end
|
11
11
|
strings << "Total time today is #{total_time_today}."
|
12
|
-
|
12
|
+
logger.log strings.join(' ')
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
@@ -21,7 +21,7 @@ module Timesheets
|
|
21
21
|
mins = ((hoursf - hours) * 60).to_i
|
22
22
|
|
23
23
|
[pluralize('hour', hours), pluralize('minute', mins)]
|
24
|
-
.reject {|string| string
|
24
|
+
.reject {|string| string == "0 hours" }
|
25
25
|
.join(', ')
|
26
26
|
end
|
27
27
|
|
data/lib/timesheets/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
class MockLogger
|
2
|
+
def log(string = "")
|
3
|
+
@log ||= ""
|
4
|
+
@log << string
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
describe Timesheets::Commands::Status do
|
9
|
+
describe "active_time == 0 minutes" do
|
10
|
+
it "prints 0 minutes" do
|
11
|
+
status = Timesheets::Commands::Status.new
|
12
|
+
mock_logger = MockLogger.new
|
13
|
+
|
14
|
+
status.stub :logger, mock_logger do
|
15
|
+
status.stub :hours_in_entry, 0 do
|
16
|
+
status.stub :rows, [[DateTime.new.to_s,nil]] do
|
17
|
+
status.run
|
18
|
+
assert_equal mock_logger.log, "Current work session has been active for 0 minutes. Total time today is 0 minutes."
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timesheets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bradley J. Spaulding
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/timesheets/csv_table.rb
|
107
107
|
- lib/timesheets/html_table.rb
|
108
108
|
- lib/timesheets/version.rb
|
109
|
+
- spec/lib/timesheets/commands/status_spec.rb
|
109
110
|
- spec/spec_helper.rb
|
110
111
|
- timesheets.gemspec
|
111
112
|
homepage: ''
|
@@ -133,4 +134,5 @@ signing_key:
|
|
133
134
|
specification_version: 4
|
134
135
|
summary: A CLI for managing timesheets.
|
135
136
|
test_files:
|
137
|
+
- spec/lib/timesheets/commands/status_spec.rb
|
136
138
|
- spec/spec_helper.rb
|