Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

All tests pass.

  • Loading branch information...
commit da59720d2681051ef78cf712ffb2a726a2ec6c2e 1 parent 3711f96
@nicholaides nicholaides authored
Showing with 27 additions and 11 deletions.
  1. +1 −1  .rspec
  2. +1 −0  Gemfile
  3. +15 −0 Gemfile.lock
  4. +10 −10 spec/schedule_atts_spec.rb
View
2  .rspec
@@ -1 +1 @@
---color
+--color --debug
View
1  Gemfile
@@ -4,3 +4,4 @@ source "http://rubygems.org"
gemspec
gem 'autotest'
+gem 'ruby-debug19'
View
15 Gemfile.lock
@@ -10,11 +10,15 @@ GEM
specs:
ZenTest (4.4.2)
activesupport (3.0.3)
+ archive-tar-minitar (0.5.2)
autotest (4.4.6)
ZenTest (>= 4.4.1)
+ columnize (0.3.2)
diff-lcs (1.1.2)
facets (2.9.0)
ice_cube (0.6.4)
+ linecache19 (0.5.11)
+ ruby_core_source (>= 0.1.4)
rspec (2.3.0)
rspec-core (~> 2.3.0)
rspec-expectations (~> 2.3.0)
@@ -23,6 +27,16 @@ GEM
rspec-expectations (2.3.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.3.0)
+ ruby-debug-base19 (0.11.24)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby_core_source (0.1.4)
+ archive-tar-minitar (>= 0.5.2)
PLATFORMS
ruby
@@ -33,4 +47,5 @@ DEPENDENCIES
facets
ice_cube (>= 0.6.4)
rspec (>= 2.3)
+ ruby-debug19
schedule_atts!
View
20 spec/schedule_atts_spec.rb
@@ -25,35 +25,35 @@
subject{ scheduled_model.schedule }
context "given :interval_unit=>none" do
let(:schedule_attributes){ { :repeat => '0', :date => '1-1-1985', :interval => '5 (ignore this)' } }
- its(:start_date){ should == Date.new(1985, 1, 1) }
- its(:all_occurrences){ should == [Date.new(1985, 1, 1)] }
+ its(:start_date){ should == Date.new(1985, 1, 1).to_time }
+ its(:all_occurrences){ should == [Date.new(1985, 1, 1).to_time] }
its(:rrules){ should be_blank }
end
context "given :interval_unit=>day" do
let(:schedule_attributes){ { :repeat => '1', :start_date => '1-1-1985', :interval_unit => 'day', :interval => '3' } }
- its(:start_date){ should == Date.new(1985, 1, 1) }
+ its(:start_date){ should == Date.new(1985, 1, 1).to_time }
its(:rrules){ should == [IceCube::Rule.daily(3)] }
- it{ subject.first(3).should == [Date.civil(1985, 1, 1), Date.civil(1985, 1, 4), Date.civil(1985, 1, 7)] }
+ it{ subject.first(3).should == [Date.civil(1985, 1, 1), Date.civil(1985, 1, 4), Date.civil(1985, 1, 7)].map(&:to_time) }
end
context "given :interval_unit=>day & :ends=>eventually & :until_date" do
let(:schedule_attributes){ { :repeat => '1', :start_date => '1-1-1985', :interval_unit => 'day', :interval => '3', :until_date => '29-12-1985', :ends => 'eventually' } }
- its(:start_date){ should == Date.new(1985, 1, 1) }
- its(:rrules){ should == [IceCube::Rule.daily(3).until(Date.new(1985, 12, 29))] }
- it{ subject.first(3).should == [Date.civil(1985, 1, 1), Date.civil(1985, 1, 4), Date.civil(1985, 1, 7)] }
+ its(:start_date){ should == Date.new(1985, 1, 1).to_time }
+ its(:rrules){ should == [ IceCube::Rule.daily(3).until(Date.new(1985, 12, 29).to_time) ] }
+ it{ subject.first(3).should == [Date.civil(1985, 1, 1), Date.civil(1985, 1, 4), Date.civil(1985, 1, 7)].map(&:to_time) }
end
context "given :interval_unit=>day & :ends=>never & :until_date" do
let(:schedule_attributes){ { :repeat => '1', :start_date => '1-1-1985', :interval_unit => 'day', :interval => '3', :until_date => '29-12-1985', :ends => 'never' } }
- its(:start_date){ should == Date.new(1985, 1, 1) }
+ its(:start_date){ should == Date.new(1985, 1, 1).to_time }
its(:rrules){ should == [IceCube::Rule.daily(3)] }
- it{ subject.first(3).should == [Date.civil(1985, 1, 1), Date.civil(1985, 1, 4), Date.civil(1985, 1, 7)] }
+ it{ subject.first(3).should == [Date.civil(1985, 1, 1), Date.civil(1985, 1, 4), Date.civil(1985, 1, 7)].map(&:to_time) }
end
context "given :interval_unit=>week & :mon,:wed,:fri" do
let(:schedule_attributes){ { :repeat => '1', :start_date => '1-1-1985', :interval_unit => 'week', :interval => '3', :monday => '1', :wednesday => '1', :friday => '1' } }
- its(:start_date){ should == Date.new(1985, 1, 1) }
+ its(:start_date){ should == Date.new(1985, 1, 1).to_time }
its(:rrules){ should == [IceCube::Rule.weekly(3).day(:monday, :wednesday, :friday)] }
it { subject.occurs_at?(ScheduleAttributes.parse_in_timezone('1985-1-2')).should be_true }
it { subject.occurs_at?(ScheduleAttributes.parse_in_timezone('1985-1-4')).should be_true }
Please sign in to comment.
Something went wrong with that request. Please try again.