Replace Timecop with new ActiveSupport helpers

This commit is contained in:
Dan Rice 2014-05-16 13:24:40 -04:00
parent 7d7e47deff
commit d0cec167a8
13 changed files with 24 additions and 27 deletions

View file

@ -183,7 +183,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
# this test is a duplicate of the unit test. Only this test covers the
# codepath in the controllers
Timecop.travel(Time.local(2012,1,1)) do
travel_to Time.local(2012,1,1) do
login_as(:admin_user)
@ -292,7 +292,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
end
def test_start_on_monthly_rec_todo
Timecop.travel(Time.local(2012,1,1)) do
travel_to Time.local(2012,1,1) do
login_as(:admin_user)

View file

@ -97,7 +97,7 @@ class StatsControllerTest < ActionController::TestCase
end
def test_actions_done_last12months_data
Timecop.travel(Time.local(2013, 1, 15)) do
travel_to Time.local(2013, 1, 15) do
login_as(:admin_user)
@current_user = User.find(users(:admin_user).id)
@current_user.todos.delete_all
@ -143,7 +143,7 @@ class StatsControllerTest < ActionController::TestCase
end
def test_empty_last12months_data
Timecop.travel(Time.local(2013, 1, 15)) do
travel_to Time.local(2013, 1, 15) do
login_as(:admin_user)
@current_user = User.find(users(:admin_user).id)
@current_user.todos.delete_all

View file

@ -435,7 +435,7 @@ class TodosControllerTest < ActionController::TestCase
login_as(:admin_user)
# given a todo in the tickler that should be activated
Timecop.travel(2.weeks.ago) do
travel_to 2.weeks.ago do
create_todo(
description: "tickler",
show_from: 1.week.from_now.
@ -715,7 +715,7 @@ class TodosControllerTest < ActionController::TestCase
end
def test_toggle_check_on_rec_todo_show_from_today
Timecop.travel(2014, 1, 15) do
travel_to Time.zone.local(2014, 1, 15) do
login_as(:admin_user)
# link todo_1 and recurring_todo_1