Fix race-condition in test_utc_time_format

Diff code posted
created at 23 Oct 16:00

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/test/unit/lib/redmine/i18n_test.rb b/test/unit/lib/redmine/i18n_test.rb
index 2d9b40d..56ba24f 100644
--- a/test/unit/lib/redmine/i18n_test.rb
+++ b/test/unit/lib/redmine/i18n_test.rb
@@ -96,11 +96,11 @@ class Redmine::I18nTest < ActiveSupport::TestCase
 
   def test_utc_time_format
     set_language_if_valid 'en'
-    now = Time.now.utc
+    now = Time.now
     Setting.date_format = '%d %m %Y'
     Setting.time_format = '%H %M'
-    assert_equal Time.now.strftime('%d %m %Y %H %M'), format_time(now)
-    assert_equal Time.now.strftime('%H %M'), format_time(now, false)
+    assert_equal now.strftime('%d %m %Y %H %M'), format_time(now.utc)
+    assert_equal now.strftime('%H %M'), format_time(now.utc, false)
   end
 
   def test_number_to_human_size_for_each_language
807 Bytes in 6 ms with coderay