serverspec/specinfra — pull request #280 by sebglazebrook (2014-12-17 09:57:32+00:00)
Title: Allow configuration to be reset to original values. Even if they are nil

I was using this via the [nodespec gem] (https://github.com/smontanari/nodespec) and I needed to disable sudo for specific tests.

Basically I needed to do this:

- capture the current state of a config value, in my case 'disable_sudo'
- set 'disable_sudo' to true
- run some tests
- reset 'disable_sudo' to it's previous value
- continue running more tests

This didn't work as disable_sudo had it's default value of `nil` and the method_missing wouldn't set nil values.

I wrote a breaking test for it and make it pass.

Let me know your thoughts.

Cheers,

Seb