time_until_break 0.1.0 → 0.1.1

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: e7232db33a1f572441ef8bd2b621e59bb60b3845
4
- data.tar.gz: d3cc6d73932af1d78df5b40f611b7d553b94ffe2
3
+ metadata.gz: e15dbc1f2395361fc9a3b20734d72c9cc08ef7e1
4
+ data.tar.gz: 209cd9860c8e5855eafcaa56ebb7b0c539a885ec
5
5
  SHA512:
6
- metadata.gz: 12355ca1005c2020a5c945d0d69a9be2cd63303d90ac492d789a3e16ba1d807fed61cd1827d5c8eb0ec73865ff46ca371ec219313bbeac7dc19e4831144b5063
7
- data.tar.gz: 8caf9a3297eff90c64904373066bba1757d47a17c66534a873eb04cc33dbd61ca737bf8ded5bf0264de1f24bbe5a4a7face57d045784b41dd7f0b1191fa15ea3
6
+ metadata.gz: baee29464232487b9999f4ecfa775dec9cc6fb2d7c33f995aa9ad23555def591cb57813cb50b463f7624d23a140bf23b8508a4e86ab2adca7da78042bc9311cc
7
+ data.tar.gz: 07789e2d383c2004f23bd43a5d1cbe8e6ed77cd02e626e8bbbd05fda97de0df1c7b60c30727aed800c4369d31123875464e392e926aa67989e6f5e6b4c224fd6
data/bin/time_until_break CHANGED
@@ -4,4 +4,4 @@ require 'time_until_break'
4
4
 
5
5
  countdown = TimeUntilBreak.new
6
6
 
7
- countdown.message
7
+ countdown.run_me
@@ -1,3 +1,3 @@
1
1
  class TimeUntilBreak
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -9,15 +9,19 @@ class TimeUntilBreak
9
9
  @break_time = Time.parse(break_time)
10
10
  end
11
11
 
12
- def message
12
+ def is_a_weekday
13
13
  has_break_been? ? missed_break : time_until_break
14
14
  end
15
15
 
16
+ def is_a_weekend
17
+ say_something("It's the weekend you silly billy.")
18
+ end
19
+
16
20
  def time_until_break
17
21
  seconds = @break_time.to_i - current_time.to_i
18
22
  hours = (seconds/(60*60))
19
23
  minutes = ((seconds - (hours*60*60))/60)
20
- say_something("#{hours} hours, #{minutes} minutes")
24
+ say_something("#{hours} hours, #{minutes} minutes until the Mandatory Break.")
21
25
  end
22
26
 
23
27
  def has_break_been?
@@ -35,4 +39,12 @@ class TimeUntilBreak
35
39
  def say_something(string)
36
40
  %x(say "#{string}")
37
41
  end
42
+
43
+ def is_it_the_weekend?
44
+ ["Saturday", "Sunday"].include?(current_time.strftime("%A"))
45
+ end
46
+
47
+ def run_me
48
+ is_it_the_weekend? ? is_a_weekend : is_a_weekday
49
+ end
38
50
  end
@@ -29,8 +29,18 @@ describe TimeUntilBreak do
29
29
 
30
30
  it 'can calculate how long until the next break in hours and minutes' do
31
31
  Delorean.time_travel_to(Time.utc(2014,11,17,10,36))
32
- expect(time).to receive(:`).with('say "6 hours, 9 minutes"')
32
+ expect(time).to receive(:`).with('say "6 hours, 9 minutes until the Mandatory Break."')
33
33
  time.message
34
34
  end
35
35
 
36
+ it 'knows if it is not the weekend' do
37
+ Delorean.time_travel_to(Time.utc(2014,11,21,10,36))
38
+ expect(time.is_it_the_weekend?).to be false
39
+ end
40
+
41
+ it 'knows if it is the weekend' do
42
+ Delorean.time_travel_to(Time.utc(2014,11,22,10,36))
43
+ expect(time.is_it_the_weekend?).to be true
44
+ end
45
+
36
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_until_break
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Giles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-18 00:00:00.000000000 Z
11
+ date: 2014-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler