time_clock 0.0.8 → 0.0.9

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: 6569afaf77b28081b3340d4d14d7a43c3975bfc0
4
- data.tar.gz: 9f46fe9b779839217f334600e9c742f55701bc09
3
+ metadata.gz: f7f53e39fd6b0983fb1ef1160404c5b62f8f4579
4
+ data.tar.gz: f605aae5a633817add00a0dea3d9f10809495235
5
5
  SHA512:
6
- metadata.gz: 99dad2a7361d566892d3383a59b1f0c2e01052f5271d35100244f938458cd6a89a2e4c37a34053519d8e7f2da8082911214f911e5326af52cca41ee1d5f29071
7
- data.tar.gz: 83b75b251622a3a3a4da4483c6c8d4e9ca32ca74edc762149be2fd82034b06613395f435e94440e220be6f4e976f86b50c3c7e1edbde708780d475753626c53f
6
+ metadata.gz: 9e0958f60c49ddfaa9a32f44847ca5a039998e0298b84fa1767843f72f7781fb8da78420c64d1f95fbed3c7a6e2b31b42a0f4fe0e38e8fbae52565aeeddc88ba
7
+ data.tar.gz: 911952184951a469b02cde5ccbdc3df29de5fd4994b6b14ace64507882b19d8afd9602b151fbe8c07d98350395ac99a5388287a5a671dd6b912c662a161a44e1
data/README.md CHANGED
@@ -13,6 +13,11 @@ Once you've set a default calendar, any `Time` instance will have a few helpful
13
13
  Time.now.business_hours_until(Time.now + 1.day)
14
14
  => 12
15
15
 
16
+ Also, `Date` and `Time` instances will have a method that calculates how many work dates there are between two times or dates.
17
+
18
+ Date.today.business_days_until(Date.today)
19
+ => 1
20
+
16
21
  You can also make custom calendars for each calculation (see Calendars section for details).
17
22
 
18
23
  **Things you may like about this library:**
@@ -1,3 +1,3 @@
1
1
  module TimeClock
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -36,10 +36,16 @@ module TimeClock
36
36
  end
37
37
 
38
38
  context "when there is no default calendar and none is provided" do
39
+ before do
40
+ @old_default_calendar = TimeClock.default_calendar
41
+ TimeClock.default_calendar = nil
42
+ end
39
43
  it "should raise an error on initialization" do
40
- TimeClock.stub(:default_calendar) { nil }
41
44
  expect{described_class.new(start_time, end_time)}.to raise_error Comparison::NilCalendarError
42
45
  end
46
+ after do
47
+ TimeClock.default_calendar = @old_default_calendar
48
+ end
43
49
  end
44
50
 
45
51
  context "when calculating seconds between" do
@@ -11,13 +11,13 @@ describe Time do
11
11
  end
12
12
 
13
13
  it "should calculate business minutes until" do
14
- Time.any_instance.stub(:business_seconds_until) { 60 }
14
+ expect_any_instance_of(Time).to receive(:business_seconds_until).and_return(60)
15
15
  expect(subject.business_minutes_until(end_time)).to eq 1
16
16
  end
17
17
 
18
18
  it "should calculate business hours until" do
19
- Time.any_instance.stub(:business_seconds_until) { 3500 }
19
+ expect_any_instance_of(Time).to receive(:business_seconds_until).and_return(3500)
20
20
  expect(subject.business_hours_until(end_time)).to eq 1
21
21
  end
22
22
 
23
- end
23
+ end
@@ -30,10 +30,10 @@ module TimeClock
30
30
  let(:overlapping_shift) { Shift.new(Time.new(2013,8,19,5), Time.new(2013,8,19,10)) }
31
31
  let(:non_overlapping_shift) { Shift.new(Time.new(2013,8,18,5), Time.new(2013,8,18,10)) }
32
32
  it "should know when it does" do
33
- expect(overlapping_shift.overlaps?(subject)).to be_true
33
+ expect(overlapping_shift.overlaps?(subject)).to eq true
34
34
  end
35
35
  it "should know when it doesn't" do
36
- expect(non_overlapping_shift.overlaps?(subject)).to_not be_true
36
+ expect(non_overlapping_shift.overlaps?(subject)).to_not eq true
37
37
  end
38
38
  it "should calculate the overlapping seconds when there is an overlap" do
39
39
  expect(overlapping_shift.overlapping_seconds(subject)).to eq 4 * 60 * 60
@@ -45,4 +45,4 @@ module TimeClock
45
45
 
46
46
 
47
47
  end
48
- end
48
+ end
@@ -9,7 +9,6 @@ end
9
9
  require 'time_clock'
10
10
 
11
11
  RSpec.configure do |config|
12
- config.treat_symbols_as_metadata_keys_with_true_values = true
13
12
  config.run_all_when_everything_filtered = true
14
13
  config.filter_run :focus
15
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_clock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - barelyknown
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-21 00:00:00.000000000 Z
11
+ date: 2015-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  requirements: []
162
162
  rubyforge_project:
163
- rubygems_version: 2.2.2
163
+ rubygems_version: 2.4.5
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: Calculate the business time for a period of time.