Patch #32929

Add missing fixtures to AttachmentsControllerTest

Added by Yuichi HARADA 25 days ago. Updated 24 days ago.

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

0%

Category:Code cleanup/refactoring
Target version:4.2.0

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 55811

# Running:

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

Error:
AttachmentsControllerTest#test_destroy_issue_attachment:
NoMethodError: undefined method `high?' for nil:NilClass
    app/models/issue.rb:1045:in `notified_users'
    app/models/journal.rb:147:in `notified_users'
    app/models/mailer.rb:130:in `deliver_issue_edit'
    app/models/journal.rb:322:in `send_notification'
    app/controllers/attachments_controller.rb:156:in `destroy'
    lib/redmine/sudo_mode.rb:64:in `sudo_mode'
    test/functional/attachments_controller_test.rb:586:in `block (2 levels) in test_destroy_issue_attachment'
    test/functional/attachments_controller_test.rb:585:in `block in test_destroy_issue_attachment'
    test/functional/attachments_controller_test.rb:584:in `test_destroy_issue_attachment'

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

.........

Finished in 2.985696s, 16.0767 runs/s, 48.5649 assertions/s.
48 runs, 145 assertions, 0 failures, 1 errors, 0 skips

I think that because the fixtures not enough.

diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index a3442f6a3..bf889892d 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -20,9 +20,9 @@
 require File.expand_path('../../test_helper', __FILE__)

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

   def setup
     User.current = nil

Associated revisions

Revision 19485
Added by Go MAEDA 24 days ago

Add missing fixtures to AttachmentsControllerTest (#32929).

Patch by Yuichi HARADA.

History

#1 Updated by Go MAEDA 25 days ago

  • Target version set to 4.2.0

#2 Updated by Go MAEDA 24 days ago

  • Subject changed from Add missing fixture to AttachmentsControllerTest to Add missing fixtures to AttachmentsControllerTest
  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch. Thank you.

Also available in: Atom PDF