beggar 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec CHANGED
@@ -1 +1 @@
1
- --color -f d
1
+ --color -f d --order rand
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- beggar (1.0.0)
4
+ beggar (1.0.2)
5
5
  httparty
6
6
 
7
7
  GEM
@@ -11,7 +11,7 @@ GEM
11
11
  httparty (0.8.1)
12
12
  multi_json
13
13
  multi_xml
14
- multi_json (1.0.4)
14
+ multi_json (1.1.0)
15
15
  multi_xml (0.4.1)
16
16
  rspec (2.8.0)
17
17
  rspec-core (~> 2.8.0)
@@ -25,7 +25,9 @@ module Beggar
25
25
  end
26
26
 
27
27
  def worked_hours
28
- current_month['time_entries'].map do |entry|
28
+ time_entries = current_month['time_entries']
29
+ return 0 if time_entries.empty?
30
+ time_entries.map do |entry|
29
31
  entry['hours']
30
32
  end.inject(:+)
31
33
  end
@@ -1,4 +1,4 @@
1
1
  module Beggar
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
4
4
 
@@ -54,6 +54,12 @@ describe Beggar::Basecamp do
54
54
  basecamp.worked_hours.should == 22.0
55
55
  end
56
56
 
57
+ it 'returns 0 when no time entries' do
58
+ response = { "time_entries" => [] }
59
+ basecamp.stub(current_month: response)
60
+ basecamp.worked_hours.should == 0
61
+ end
62
+
57
63
  it 'returns hours ratio with minus when working hours > weekdays hours' do
58
64
  basecamp.stub(worked_hours: 106.0)
59
65
  basecamp.hours_ratio.should == -2.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beggar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-22 00:00:00.000000000 Z
12
+ date: 2012-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70364544025140 !ruby/object:Gem::Requirement
16
+ requirement: &70354965969800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.7.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70364544025140
24
+ version_requirements: *70354965969800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: httparty
27
- requirement: &70364544023600 !ruby/object:Gem::Requirement
27
+ requirement: &70354965969380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70364544023600
35
+ version_requirements: *70354965969380
36
36
  description: Tool for generating time reports from Basecamp. You can specify rate
37
37
  for each project and get value of your month salary.
38
38
  email: