Project

General

Profile

Actions

Patch #34321

closed

Add missing fixtures to AttachmentsControllerTest

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

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

0%

Estimated time:

Description

AttachmentsControllerTest has failed.

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

$ RAILS_ENV=test bundle exec rake test TEST=test/functional/attachments_controller_test.rb
Run options: --seed 62032

# Running:

.....................................E

Error:
AttachmentsControllerTest#test_destroy_issue_attachment:
ActionView::Template::Error: undefined method `is_closed?' for nil:NilClass
    app/helpers/issue_statuses_helper.rb:22:in `issue_status_type_badge'
    app/views/mailer/_issue.html.erb:3:in `_app_views_mailer__issue_html_erb___4391335022488939404_70210668642100'
    app/views/mailer/issue_edit.html.erb:15:in `_app_views_mailer_issue_edit_html_erb__951082845966517113_70210668542720'
    app/models/mailer.rb:709:in `block in mail'
    app/models/mailer.rb:707:in `mail'
    app/models/mailer.rb:123:in `issue_edit'
    app/models/mailer.rb:48:in `process'
    app/models/mailer.rb:137:in `block in deliver_issue_edit'
    app/models/mailer.rb:136:in `each'
    app/models/mailer.rb:136:in `deliver_issue_edit'
    app/models/journal.rb:337:in `send_notification'
    app/controllers/attachments_controller.rb:174:in `destroy'
    lib/redmine/sudo_mode.rb:61:in `sudo_mode'
    test/functional/attachments_controller_test.rb:642:in `block (2 levels) in test_destroy_issue_attachment'
    test/functional/attachments_controller_test.rb:641:in `block in test_destroy_issue_attachment'
    test/functional/attachments_controller_test.rb:640:in `test_destroy_issue_attachment'

bin/rails test test/functional/attachments_controller_test.rb:636

..............

Finished in 3.631273s, 14.3200 runs/s, 43.2355 assertions/s.
52 runs, 157 assertions, 0 failures, 1 errors, 0 skips

Files

fixed-34321.patch (726 Bytes) fixed-34321.patch Yuichi HARADA, 2020-11-27 02:11
Actions #1

Updated by Yuichi HARADA about 4 years ago

The cause was insufficient fixtures. The following patch solves this issue.

diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index 6372fb646..a557a1bd7 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -21,7 +21,7 @@ require File.expand_path('../../test_helper', __FILE__)

 class AttachmentsControllerTest < Redmine::ControllerTest
   fixtures :users, :user_preferences, :projects, :roles, :members, :member_roles,
-           :enabled_modules, :issues, :trackers, :attachments,
+           :enabled_modules, :issues, :trackers, :attachments, :issue_statuses, :journals, :journal_details,
            :versions, :wiki_pages, :wikis, :documents, :enumerations

   def setup
Actions #2

Updated by Go MAEDA about 4 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Target version set to 4.2.0

Committed the fix. Thank you.

Actions

Also available in: Atom PDF