Project

General

Profile

Actions

Refactor #16220

closed

Replace skip_callback in factories with stubbing

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

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

Actions

Also available in: Atom PDF