ice_t 0.0.4 → 0.0.5

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: 4f45183041524f2add8f09a2a163212717bd35ca
4
- data.tar.gz: a4aff30ce9adff183d1b5542e97cb6779fa46d99
3
+ metadata.gz: eb428538b8a07c2a90ccbdbf9278611e26b8c3e7
4
+ data.tar.gz: 4d480848e28958d21f470ca58fb8555e7bbf09b6
5
5
  SHA512:
6
- metadata.gz: e7a0453d29ab8baadd22ab916b3306c8da871d27d26aee24ec4ee8a8f7db496400f5a12f1433e6aac8e54b7da237df37f41499af71c1a0a2d26568970089fb27
7
- data.tar.gz: ca7784d2b5274e61409d60dda498071889631629c92babada557d4d13f5b4e3703f3504cad534ef5a35f71d6311db01b7cf09dbe5861389270f08c83e94485b9
6
+ metadata.gz: 54c69688a04d0f7e15c7c16dbb50157458389582f04f6e3a8c7d410b415bb8f759c0070b97e3379203d172d89f1f231bff493451099b58bd836017561939d11a
7
+ data.tar.gz: dc5d8e56b1125384aa1bf6aedf72ecb4e826e508fe9e48a55a2cef7172a7c3def870752c0c512a74bf74a3def081b9289d25954fc2d6d61892b60ef7aa0e7df2
@@ -53,7 +53,7 @@ module IceT
53
53
 
54
54
  def occurrences(start_time, end_time)
55
55
  diff = IceT::TimeHelper.diff_by_unit(start_time, end_time, self.class.unit)
56
- (1..diff).step(self.interval).map { |i|
56
+ (0..diff).step(self.interval).map { |i|
57
57
  start_time.advance(self.class.unit => i)
58
58
  }
59
59
  end
data/lib/ice_t/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IceT
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,33 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe IceT::Rule::Monthly do
4
-
5
4
  let(:klass) { IceT::Rule::Monthly }
6
- it_behaves_like "a rule"
7
-
8
- let!(:interval) { 1 }
9
- let!(:start_time) { 1.year.ago }
10
- let!(:end_time) { Time.now }
11
- let(:rule) { IceT::Rule::Monthly.new(interval) }
12
-
13
-
14
- describe "#occurrences" do
15
-
16
- subject { rule.occurrences(start_time, end_time) }
17
-
18
- it "returns an array" do
19
- expect(subject).to be_an(Array)
20
- end
21
-
22
- context "one year ago until now" do
23
- it "returns an array with 12 elements" do
24
- expect(subject.size).to eql(12)
25
- end
26
- it "contains end_time as last element" do
27
- expect(subject.last.to_date).to eql(end_time.to_date)
28
- end
29
- end
30
-
31
- end
32
-
5
+ it_behaves_like "a rule"
33
6
  end
@@ -9,6 +9,19 @@ shared_examples 'a rule' do
9
9
 
10
10
  describe '#occurrences' do
11
11
  it { expect(klass.new).to respond_to(:occurrences) }
12
+
13
+ let(:rule){ klass.new(1) }
14
+ let(:start_time){ Time.now }
15
+ let(:duration){ eval("2.#{klass.unit}") }
16
+ let(:end_time){ start_time + duration }
17
+ subject { rule.occurrences(start_time, start_time + duration) }
18
+
19
+ it 'does contain the start_time' do
20
+ expect(subject.first).to eql(start_time)
21
+ end
22
+ it 'does contain the end_time' do
23
+ expect(subject.last).to eql(end_time)
24
+ end
12
25
  end
13
26
 
14
27
  describe '::from_json' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ice_t
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Nennemann