Patch #33376

Add missing fixtures to VersionsHelperTest

Added by Yuichi HARADA about 1 month ago. Updated 30 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Code cleanup/refactoring
Target version:4.2.0

Description

VersionsHelperTest has failed.

$ RAILS_ENV=test bundle exec rake db:migrate:reset

$ RAILS_ENV=test bundle exec rake test TEST=test/helpers/version_helper_test.rb
Run options: --seed 60566

# Running:

E

Error:
VersionsHelperTest#test_link_to_new_issue_should_take_into_account_user_permissions_on_fixed_version_id_field:
ActiveRecord::RecordInvalid: Validation failed: Tracker cannot be blank, Old status cannot be blank
    test/helpers/version_helper_test.rb:103:in `test_link_to_new_issue_should_take_into_account_user_permissions_on_fixed_version_id_field'

bin/rails test test/helpers/version_helper_test.rb:101

.......E

Error:
VersionsHelperTest#test_link_to_new_issue_should_return_nil_if_user_does_not_have_permission_to_add_issue:
ActiveRecord::RecordNotFound: Couldn't find User with 'id'=2 [WHERE "users"."type" IN ('User', 'AnonymousUser')]
    test/helpers/version_helper_test.rb:81:in `test_link_to_new_issue_should_return_nil_if_user_does_not_have_permission_to_add_issue'

bin/rails test test/helpers/version_helper_test.rb:77

E

Error:
VersionsHelperTest#test_link_to_new_issue_should_return_link_to_add_issue:
TypeError: no implicit conversion of nil into String
    test/test_helper.rb:241:in `initialize'
    test/test_helper.rb:241:in `new'
    test/test_helper.rb:241:in `assert_select_in'
    test/helpers/version_helper_test.rb:65:in `test_link_to_new_issue_should_return_link_to_add_issue'

bin/rails test test/helpers/version_helper_test.rb:57

E

Error:
VersionsHelperTest#test_link_to_new_issue_should_return_nil_if_no_tracker_is_available_for_project:
ActiveRecord::RecordNotFound: Couldn't find User with 'id'=2 [WHERE "users"."type" IN ('User', 'AnonymousUser')]
    test/helpers/version_helper_test.rb:96:in `test_link_to_new_issue_should_return_nil_if_no_tracker_is_available_for_project'

bin/rails test test/helpers/version_helper_test.rb:86

.

Finished in 0.930490s, 12.8964 runs/s, 11.8217 assertions/s.
12 runs, 11 assertions, 0 failures, 4 errors, 0 skips
$

33376.patch Magnifier (707 Bytes) Yuichi HARADA, 2020-04-30 04:25

Associated revisions

Revision 19738
Added by Go MAEDA 30 days ago

Add missing fixtures to VersionsHelperTest (#33376).

Patch by Yuichi HARADA.

History

#1 Updated by Yuichi HARADA about 1 month ago

I think that because of the fixtures are not enough.

diff --git a/test/helpers/version_helper_test.rb b/test/helpers/version_helper_test.rb
index 01ecf910f..a0a16d341 100644
--- a/test/helpers/version_helper_test.rb
+++ b/test/helpers/version_helper_test.rb
@@ -22,7 +22,10 @@ require File.expand_path('../../test_helper', __FILE__)
 class VersionsHelperTest < Redmine::HelperTest
   include Rails.application.routes.url_helpers

-  fixtures :projects, :versions
+  fixtures :projects, :versions, :enabled_modules,
+           :users, :members, :roles, :member_roles,
+           :trackers, :projects_trackers,
+           :issue_statuses

   def test_version_filtered_issues_path_sharing_none
     version = Version.new(:name => 'test', :sharing => 'none')

#2 Updated by Go MAEDA about 1 month ago

  • Target version set to 4.2.0

I have confirmed that the test fails if any of the newly added fixture by the patch is missing.

Setting the target version to 4.2.0.

#3 Updated by Go MAEDA 30 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch. Thank you for detecting and fixing the issue.

Also available in: Atom PDF