Project

General

Profile

Bug #18159

Test sets @request.session to nil, should use #clear

Added by Dominic Cleal over 5 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Tests
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

The "UsersControllerTest#test_0023_should create and login external user" test attempts to use an empty session for a request by setting @request.session to nil, but this causes an error inside the Rails test cases under Rails 5.0.0 or higher.

NoMethodError: undefined method `update' for nil:NilClass
actionpack (5.0.0) lib/action_controller/test_case.rb:516:in `process'
apipie-rails (0.3.6) lib/apipie/extractor/recorder.rb:153:in `process_with_api_recording'
rails-controller-testing (0.1.1) lib/rails/controller/testing/template_assertions.rb:61:in `process'
actionpack (5.0.0) lib/action_controller/test_case.rb:634:in `process_with_kwargs'
actionpack (5.0.0) lib/action_controller/test_case.rb:381:in `get'
test/controllers/users_controller_test.rb:230:in `block in <class:UsersControllerTest>'

The correct method of emptying a session is to use #clear rather than removing it from the request object.

Associated revisions

Revision 764ae7e0 (diff)
Added by Dominic Cleal over 5 years ago

fixes #18159 - change incorrect clearing of test request session

History

#1 Updated by The Foreman Bot over 5 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4210 added

#2 Updated by Dominic Cleal over 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Dominic Cleal over 5 years ago

  • Legacy Backlogs Release (now unused) set to 209

Also available in: Atom PDF