Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #39

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion lib/recurrence/event/monthly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Monthly < Base # :nodoc: all
end

private def shift_to(date)
@options[:on] = date.day
@options[:on] = date.day unless @options[:weekday].present?
end

private def valid_ordinal?(ordinal)
Expand Down
2 changes: 1 addition & 1 deletion test/recurrence/daily_recurring_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DailyRecurringTest < Minitest::Test
assert_equal date.to_date, r.events[-1]
end

test "starts 2 months ago (#{2.months.ago.to_s(:date)})" do
test "starts 2 months ago (#{2.months.ago})" do
date = 2.months.ago
r = recurrence(every: :day, starts: date.to_date)
assert_equal date.to_date, r.events[0]
Expand Down
9 changes: 9 additions & 0 deletions test/recurrence/date_shift_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,13 @@ class DateShiftTest < Minitest::Test

assert_equal Date.new(2012, 2, 29), r.next
end

test "correctly recurrs for weekdays" do
r = recurrence(every: :month, starts: "2011-01-31", on: "first",
weekday: "monday", shift: true)

assert_equal Date.new(2011, 2, 7), r.events[0]
assert_equal Date.new(2011, 3, 7), r.events[1]
assert_equal Date.new(2011, 4, 4), r.events[2]
end
end
2 changes: 1 addition & 1 deletion test/recurrence/weekly_recurring_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class WeeklyRecurringTest < Minitest::Test
assert_equal date.to_date, r.events[-1]
end

test "starts 3 months ago (#{3.months.ago.to_s(:date)})" do
test "starts 3 months ago (#{3.months.ago})" do
date = 3.months.ago

r = recurrence(every: :week, on: date.wday, starts: date.to_date)
Expand Down
Loading