Project

General

Profile

Actions

Bug #18159

closed

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

Added by Dominic Cleal over 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Tests
Target version:
Difficulty:
Triaged:
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.

Actions #1

Updated by The Foreman Bot over 7 years ago

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

Updated by Dominic Cleal over 7 years ago

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

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release set to 209
Actions

Also available in: Atom PDF