-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
In our tests, we make use of rspec's before/after/around lifecycle hooks to set the state of the test, including configatron settings with configatron.temp. Unfortunately when you have multiple configatron.temp competing with each other (one wrapping the other basically), it produces some results that we didn't expect:
[3] pry(main)> configatron.foo = 1
1
[4] pry(main)> configatron.temp do
[4] pry(main)* configatron.foo = 2
[4] pry(main)* configatron.temp do
[4] pry(main)* configatron.foo = 3
[4] pry(main)* end
[4] pry(main)* end
3
[5] pry(main)>
[6] pry(main)> configatron.foo
2
In this example, our our tests assumed that the settings would be returned to their original state, which in this example would be configatron.foo = 1
Is there a more elegant way to achieve what we want here with temp? In the short term, we've restored to manually holding the state of the variable we are setting and then resetting it at the end of the before/around block
Metadata
Metadata
Assignees
Labels
No labels