Skip to content
This repository was archived by the owner on May 8, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 5 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,12 @@ branches:
only:
- master
rvm:
- 1.9.3
- 2.0
- 2.1.10
- 2.2.6
- 2.3.3
- 2.4.0
- 2.3.7
- 2.4.4
- 2.5.1
- ruby-head
env:
- RAILS_VERSION='~> 3.2'
- RAILS_VERSION='~> 4.2'
- RAILS_VERSION='~> 5.0'
matrix:
exclude:

# Rails 5 only runs on ruby 2.3 and up
- rvm: 1.9.3
env: RAILS_VERSION='~> 5.0'
- rvm: 2.0
env: RAILS_VERSION='~> 5.0'
- rvm: 2.1.10
env: RAILS_VERSION='~> 5.0'
- rvm: 2.2.6
env: RAILS_VERSION='~> 5.0'

# Rails 3 no longer runs on ruby 2.4 and up
- rvm: 2.4.0
env: RAILS_VERSION='~> 3.2'
- rvm: ruby-head
env: RAILS_VERSION='~> 3.2'
- RAILS_VERSION='~> 5.1'
- RAILS_VERSION='~> 5.2'
8 changes: 1 addition & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
source 'https://rubygems.org'
gemspec

compatible_rails_versions = [
'>= 3.0.0',
('<5' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2'))
].compact

gem 'activesupport', (ENV['RAILS_VERSION'] || compatible_rails_versions), require: false
gem 'activesupport', (ENV['RAILS_VERSION'] || '>= 4.2'), require: false
gem 'i18n', require: false
gem 'tzinfo', require: false # only needed explicitly for RAILS_VERSION=3
2 changes: 1 addition & 1 deletion config/locales/sv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ sv:
- Aug
- Sep
- Okt
- Mov
- Nov
- Dec
day_names:
- Söndag
Expand Down
3 changes: 0 additions & 3 deletions ice_cube.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ice_cube/version'
Expand All @@ -15,9 +14,7 @@ Gem::Specification.new do |s|
s.version = IceCube::VERSION
s.platform = Gem::Platform::RUBY
s.files = Dir['lib/**/*.rb', 'config/**/*.yml']
s.test_files = Dir.glob('spec/*.rb')
s.require_paths = ['lib']
s.has_rdoc = true

s.add_development_dependency('rake')
s.add_development_dependency('rspec', '> 3')
Expand Down
2 changes: 1 addition & 1 deletion lib/ice_cube/validations/hour_of_day.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def realign(opening_time, start_time)

first_hour = Array(validations[:hour_of_day]).min_by(&:value)
time = TimeUtil::TimeWrapper.new(start_time, false)
if freq > 1
if freq > 1 && base_interval_validation.type == :hour
offset = first_hour.validate(opening_time, start_time)
time.add(:hour, offset - freq)
else
Expand Down
20 changes: 20 additions & 0 deletions spec/examples/weekly_rule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,26 @@ module IceCube
end
end
end

# August 2018
# Su Mo Tu We Th Fr Sa
# 1 2 3 4
# 5 6 7 8 9 10 11
# 12 13 14 15 16 17 18
# 19 20 21 22 23 24 25
# 26 27 28 29 30 31
context 'when day of start_time does not align with specified day rule' do
let(:start_time) { Time.utc(2018, 8, 7, 10, 0, 0) }
let(:end_time) { Time.utc(2018, 8, 7, 15, 0, 0) }
let(:biweekly) { IceCube::Rule.weekly(2).day(:saturday).hour_of_day(10) }
let(:schedule) { IceCube::Schedule.new(start_time, end_time: end_time) { |s| s.rrule biweekly } }
let(:range) { [Time.utc(2018, 8, 11, 7, 0, 0), Time.utc(2018, 8, 12, 6, 59, 59)] }
let(:expected_date) { Time.utc(2018, 8, 11, 10, 0, 0) }

it 'should align to the correct day with the spans option' do
expect(schedule.occurrences_between(range.first, range.last, spans: true)).to include expected_date
end
end
end

describe "using occurs_between with a weekly schedule" do
Expand Down