mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-07 16:24:21 +01:00
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
This commit is contained in:
parent
0b44fe3f08
commit
e58379e81f
27 changed files with 221 additions and 214 deletions
23
test/fixtures/notes.yml
vendored
23
test/fixtures/notes.yml
vendored
|
|
@ -1,16 +1,19 @@
|
|||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||
<%
|
||||
def today
|
||||
Time.now.utc.to_s(:db)
|
||||
|
||||
# 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.to_s(:db)
|
||||
end
|
||||
|
||||
def next_week
|
||||
1.week.from_now.utc.to_s(:db)
|
||||
|
||||
def next_week
|
||||
1.week.from_now.utc.to_s(:db)
|
||||
end
|
||||
|
||||
def last_week
|
||||
1.week.ago.utc.to_s(:db)
|
||||
end
|
||||
|
||||
def last_week
|
||||
1.week.ago.utc.to_s(:db)
|
||||
end
|
||||
%>
|
||||
|
||||
first_notes:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue