Actions
Patch #41623
closedFix tests that randomly failed due to required fixtures not being loaded
Description
This patch fixes tests that randomly failed due to required fixtures not being loaded.
Below are failure logs of these tests.
    Error:
    Redmine::ApiTest::UsersTest#test_GET_/users/:id.json_with_include=auth_source_should_include_auth_source_for_administrators:
    NoMethodError: undefined method `id' for nil
        test/integration/api_test/users_test.rb:233:in `block in
    <class:UsersTest>'
    bin/rails test test/integration/api_test/users_test.rb:225
    Error:
    Redmine::NumericFieldFormatTest#test_integer_field_should_format_with_thousands_delimiter:
    ActiveRecord::RecordNotFound: Couldn't find Issue with 'id'=1
        test/unit/lib/redmine/field_format/numeric_format_test.rb:66:in
    `test_integer_field_should_format_with_thousands_delimiter'
    bin/rails test
    test/unit/lib/redmine/field_format/numeric_format_test.rb:64
    Failure:
    ChangesetTest#test_ref_keywords_closing_with_timelog
    [test/unit/changeset_test.rb:169]:
    Expected false to be truthy.
    bin/rails test test/unit/changeset_test.rb:153
	The changeset_test is failing with a validation error due to the version fixture not being loaded.
From: /redmine/app/models/changeset.rb @ line 260 :
    255:
Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update,
    256:                             {:changeset => self, :issue =>
issue, :action => action})
    257:
    258:     if issue.changes.any?
    259:       unless issue.save
 => 260:         binding.irb
    261:         logger.warn("Issue ##{issue.id} could not be saved by
changeset #{id}: #{issue.errors.full_messages}") if logger
    262:       end
    263:     else
    264:       issue.clear_journal
    265:     end
irb(#<Changeset:0x000073145f1036a0>):001> issue.id
=> 2
irb(#<Changeset:0x000073145f1036a0>):002> issue.errors.full_messages
=> ["Target version is not included in the list"]
  Files
      
      Updated by Katsuya HIDAKA about 1 year ago
      
    
    The changeset_test is also failing with the following error.
Failure: ChangesetTest#test_ref_keywords_any [test/unit/changeset_test.rb:53]: Expected: 3 Actual: 2 bin/rails test test/unit/changeset_test.rb:39
I've fixed the above test failure by adding :watchers to the fixtures.
      
      Updated by Marius BĂLTEANU 12 months ago
      
    
    - Target version changed from 6.1.0 to 6.0.2
 
I've merged these fixes to 6.0-stable because we have a test failure on that branch from same reasons.
Actions