Run tests in random order#298
Conversation
This fixes the `const_name` tests in particular to be order-independent, but also just makes it more difficult in general to introduce new tests that are order-dependent.
This'll make it easier for tests to get a clean set of options, especially if they run after tests that modify `fail_on_missing`.
This makes many tests in this suite order-independent. Without it, several tests fail if executed after a test that sets `fail_on_missing` to `true`.
|
Why do we need to set |
There a a good number of tests that expect config/spec/config_env_spec.rb Lines 109 to 119 in c59d105 If An alternative fix I considered is to just add an git apply <<'PATCH'
diff --git a/spec/options_spec.rb b/spec/options_spec.rb
index 8f49a8d..9287c77 100644
--- a/spec/options_spec.rb
+++ b/spec/options_spec.rb
@@ -132,6 +132,7 @@ describe Config::Options do
context 'when fail_on_missing option' do
context 'is set to true' do
before { Config.setup { |cfg| cfg.fail_on_missing = true } }
+ after { Config.setup { |cfg| cfg.fail_on_missing = false } }
it 'should raise an error when accessing a missing key' do
config = Config.load_files("#{fixture_path}/empty1.yml")
PATCHIn general though, I think this approach is prone to error since it's easy to forget to add something like this when someone introduces a new test that modifies config attributes. The cost is relatively small to just |
|
@pkuczynski LMK if this looks good! |
Fixes #198
Fixes #231