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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2abcb0cf8baf4b0838f0b13d3807f45d763aca8
4
- data.tar.gz: 843edea1155b36e7625b5b1d2e375035c151195b
3
+ metadata.gz: 0b28d192d2b2b71887d1e08d16dca0e4b74ea41e
4
+ data.tar.gz: e9cf99cdb3d74adccd7c12646bd022a176cb929e
5
5
  SHA512:
6
- metadata.gz: 18d7c881fa72f4909da310cc92d35e4f49de22aacd4c90426dbbd097bb8cde0e4339e19ef8c572ee04a7f62b0925d5a3d3fb91061aa96bfcb1622af907a730fd
7
- data.tar.gz: 1da375be03f41b04c0209fb2564016a5a82ffc3e24585d0015de3e5b0f6b41b3f82892e3e2a44065b54f85999d9b509aee702ac642ef1f847133d7af7954ecbd
6
+ metadata.gz: 6439beb36e70f770d0429528f77f1b96b0f186e43e98a9808875f5065491811b26db83e81e663bf735da03f4c947a9d4e9b05ad3c7824f2f77b03611f52440e4
7
+ data.tar.gz: a37b63ef32190967a4e5b73f86a403ca06958840ed894d66f084f17591ac42f35a7d4640add13196786b4c46c5159528db3de28ebc11c13ea0724ba66aff6d94
@@ -1,4 +1,10 @@
1
- module Timesheets; end
1
+ module Timesheets
2
+ class Logger
3
+ def log(string)
4
+ puts string
5
+ end
6
+ end
7
+ end
2
8
 
3
9
  require "timesheets/version"
4
10
  require "timesheets/cli"
@@ -8,11 +8,15 @@ module Timesheets
8
8
  end
9
9
 
10
10
  def initialize(options = {})
11
- @options = options
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
- puts strings.join(' ')
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[0] == "0" }
24
+ .reject {|string| string == "0 hours" }
25
25
  .join(', ')
26
26
  end
27
27
 
@@ -1,3 +1,3 @@
1
1
  module Timesheets
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
@@ -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.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-12 00:00:00.000000000 Z
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