tracks/test/fixtures/recurring_todos.yml
Reinier Balt e58379e81f This fixes failing tests when the timezone is different than utc
There were several problems:
* Time.now returns the systems time, not the users time
* fixtures do not translate dates from timezone to utc, but stores the
  date verbatim
* calling a controller will set the timezone to the preference of the
  current_user. So it could be changed while you do not realize this. I
  fixed the failing test, but problems could be elsewhere
2015-08-05 11:50:33 +02:00

164 lines
3.2 KiB
YAML

# Please note that dates in yml are not converted to utc timezone like
# rails does automatically in models or controllers! Convert to utc manually!
<%
def today
Time.zone.now.utc.beginning_of_day.to_s(:db)
end
def next_week
1.week.from_now.utc.beginning_of_day.to_s(:db)
end
def last_week
1.week.ago.utc.beginning_of_day.to_s(:db)
end
def two_weeks_ago
2.weeks.ago.utc.beginning_of_day.to_s(:db)
end
def two_weeks_hence
2.weeks.from_now.utc.beginning_of_day.to_s(:db)
end
def way_back
Time.zone.local(2008,1,1).utc.to_s(:db)
end
%>
call_bill_gates_every_day:
id: 1
user_id: 1
context_id: 1
project_id: 2
description: Call Bill Gates every day
notes: ~
state: active
start_from: <%= way_back %>
ends_on: no_end_date
end_date: ~
number_of_occurrences: ~
target: due_date
show_from_delta: ~
recurring_period: daily
recurrence_selector: ~
show_always: true
every_other1: 1
every_other2: ~
every_other3: ~
every_day: ~
only_work_days: false
every_count: ~
weekday: ~
created_at: <%= last_week %>
completed_at: ~
call_bill_gates_every_workday:
id: 2
user_id: 1
context_id: 1
project_id: 2
description: Call Bill Gates every workday
notes: ~
state: active
start_from: ~
ends_on: no_end_date
end_date: ~
number_of_occurrences: ~
target: due_date
show_from_delta: ~
show_always: false
recurring_period: daily
recurrence_selector: ~
every_other1: 1
every_other2: ~
every_other3: ~
every_day: ~
only_work_days: true
every_count: ~
weekday: ~
created_at: <%= last_week %>
completed_at: ~
call_bill_gates_every_week:
id: 3
user_id: 1
context_id: 1
project_id: 2
description: Call Bill Gates every week
notes: ~
state: active
start_from: <%= way_back %>
ends_on: no_end_date
end_date: ~
number_of_occurrences: ~
target: due_date
show_from_delta: 5
recurring_period: weekly
recurrence_selector: ~
show_always: false
every_other1: 2
every_other2: ~
every_other3: ~
every_day: smtwtfs
only_work_days: false
every_count: ~
weekday: ~
created_at: <%= last_week %>
completed_at: ~
check_with_bill_every_last_friday_of_month:
id: 4
user_id: 1
context_id: 1
project_id: 2
description: Check with Bill every last friday of the month
notes: ~
state: active
start_from: <%= way_back %>
ends_on: no_end_date
end_date: ~
number_of_occurrences: ~
target: due_date
show_from_delta: 5
recurring_period: monthly
recurrence_selector: 1
show_always: false
every_other1: 1
every_other2: 2
every_other3: 5
every_day: ~
only_work_days: false
every_count: 5
weekday: ~
created_at: <%= last_week %>
completed_at: ~
birthday_reinier:
id: 5
user_id: 1
context_id: 1
project_id: 2
description: Congratulate Reinier on his birthday
notes: ~
state: active
start_from: <%= way_back %>
ends_on: no_end_date
end_date: ~
number_of_occurrences: ~
target: due_date
show_from_delta: 5
show_always: false
recurring_period: yearly
recurrence_selector: 0
every_other1: 8
every_other2: 6
every_other3: ~
every_day: ~
only_work_days: false
every_count: ~
weekday: ~
created_at: <%= last_week %>
completed_at: ~