Project

General

Profile

Actions

Patch #33376

closed

Add missing fixtures to VersionsHelperTest

Added by Yuichi HARADA over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

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
$

Files

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

Updated by Yuichi HARADA over 4 years 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')
Actions #2

Updated by Go MAEDA over 4 years 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.

Actions #3

Updated by Go MAEDA over 4 years ago

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

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

Actions

Also available in: Atom PDF