Project

General

Profile

Actions

Patch #44073

open

TimeEntryTest#test_should_not_accept_closed_issue fails randomly depending on locale

Added by Kenta Kumojima about 4 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Code cleanup/refactoring
Target version:
-

Description

TimeEntryTest#test_should_not_accept_closed_issue may fail if another test changes the locale before this test runs.

For example, the following execution fails:

$ ./bin/rails test --seed 8753 test/unit/mailer_test.rb:1083 test/unit/time_entry_test.rb:186

Run options: --seed 8753

# Running:

.F

Failure:
TimeEntryTest#test_should_not_accept_closed_issue [test/unit/time_entry_test.rb:186]:
--- expected
+++ actual
@@ -1 +1 @@
-"Cannot log time on a closed issue" 
+"Impossibile registrare il tempo su una segnalazione chiusa" 

bin/rails test test/unit/time_entry_test.rb:178

Finished in 1.453652s, 1.3758 runs/s, 4.1275 assertions/s.
2 runs, 6 assertions, 1 failures, 0 errors, 0 skips

This test should set the locale to 'en', like the other tests in the same class.

diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb
index 19b1ba2a4..e914130cc 100644
--- a/test/unit/time_entry_test.rb
+++ b/test/unit/time_entry_test.rb
@@ -176,6 +176,7 @@ class TimeEntryTest < ActiveSupport::TestCase
   end

   def test_should_not_accept_closed_issue
+    set_language_if_valid 'en'
     with_settings :timelog_accept_closed_issues => '0' do
       project = Project.find(1)
       entry = TimeEntry.generate project: project

No data to display

Actions

Also available in: Atom PDF