Commit de9ba3e
committed
Fix after hook to handle mocked Syslog singleton
The after hook that resets @syslog was causing mock expectation errors
in config_spec tests that stub Syslog.instance to be called exactly
twice. The hook's additional call violated these expectations.
Fix by:
- Wrapping the reset in begin/rescue to catch MockExpectationError
- Only resetting if the instance responds to instance_variable_set
(protecting against doubles that don't implement this method)
This allows tests that mock the singleton to work correctly while still
preventing mock leakage in tests that use the real singleton.1 parent 225c641 commit de9ba3e
1 file changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
211 | 219 | | |
212 | 220 | | |
213 | 221 | | |
| |||
0 commit comments