mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-25 02:06:10 +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
|
|
@ -98,7 +98,7 @@ class ProjectTest < ActiveSupport::TestCase
|
|||
assert_equal :completed, @timemachine.aasm.current_state
|
||||
assert @timemachine.completed?
|
||||
assert_not_nil @timemachine.completed_at, "completed_at not expected to be nil"
|
||||
assert_in_delta Time.now, @timemachine.completed_at, 1
|
||||
assert_in_delta Time.zone.now, @timemachine.completed_at, 1
|
||||
end
|
||||
|
||||
def test_delete_project_deletes_todos_within_it
|
||||
|
|
@ -254,5 +254,4 @@ class ProjectTest < ActiveSupport::TestCase
|
|||
p.reload
|
||||
assert_equal 4, p.running_time
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue