Project

General

Profile

Refactor #16220

Replace skip_callback in factories with stubbing

Added by Dominic Cleal almost 4 years ago. Updated about 2 years ago.

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

Description

Compute resource factories currently call skip_callback on compute resources classes when constructing instances to disable contact with the CR, key generation, e.g.

after(:build) { |host| host.class.skip_callback(:create, :after, :setup_key_pair) }

On Rails 5.0, calling skip_callback for a non-existent callback now raises an error by default, so when this is called twice on the same class, it will fail the second time as the callback's been deleted.

To prevent modifying the class itself, the methods should be stubbed like other factories so that the callbacks are run, but have no effect.

Associated revisions

Revision 8563088e (diff)
Added by Dominic Cleal almost 4 years ago

fixes #16220 - replace skip_callback class changes with stubs

History

#1 Updated by The Foreman Bot almost 4 years ago

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

#2 Updated by Dominic Cleal almost 4 years ago

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

#3 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 160

Also available in: Atom PDF