Skip to content

Commit

Permalink
Run tests in random order (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjlarose authored Dec 20, 2020
1 parent c59d105 commit c53194d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--color
--format progress
--format progress
--order random
17 changes: 9 additions & 8 deletions spec/config_env_spec.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
require 'spec_helper'

describe Config::Options do
before :each do
Config.reset
end

context 'when overriding settings via ENV variables is enabled' do
let(:config) do
Config.load_files "#{fixture_path}/settings.yml", "#{fixture_path}/multilevel.yml"
end

before :all do
Config.use_env = true
end

after :all do
Config.use_env = false
end

before :each do
ENV.clear

Config.env_prefix = nil
Config.env_separator = '.'
Config.env_converter = :downcase
Config.env_parse_values = true
Config.use_env = true
Config.env_prefix = nil
Config.env_separator = '.'
Config.env_converter = :downcase
Config.env_parse_values = true
end

it 'should add new setting from ENV variable' do
Expand Down
9 changes: 3 additions & 6 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'spec_helper'

describe Config do
before :each do
Config.reset
end

it "should get setting files" do
config = Config.setting_files("root/config", "staging")
Expand Down Expand Up @@ -349,15 +352,12 @@
context 'using knockout_prefix' do
context 'in configuration phase' do
it 'should be able to assign a different knockout_prefix value' do
Config.reset
Config.knockout_prefix = '--'

expect(Config.knockout_prefix).to eq('--')
end

it 'should have the default knockout_prefix value equal nil' do
Config.reset

expect(Config.knockout_prefix).to eq(nil)
end
end
Expand Down Expand Up @@ -389,15 +389,12 @@
context 'using overwrite_arrays' do
context 'in configuration phase' do
it 'should be able to assign a different overwrite_arrays value' do
Config.reset
Config.overwrite_arrays = false

expect(Config.overwrite_arrays).to eq(false)
end

it 'should have the default overwrite_arrays value equal false' do
Config.reset

expect(Config.overwrite_arrays).to eq(true)
end
end
Expand Down
7 changes: 3 additions & 4 deletions spec/options_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'spec_helper'

describe Config::Options do
before :each do
Config.reset
end

context 'when Settings file is using keywords reserved for OpenStruct' do
let(:config) do
Expand Down Expand Up @@ -127,8 +130,6 @@
end

context 'when fail_on_missing option' do
before { Config.reset }

context 'is set to true' do
before { Config.setup { |cfg| cfg.fail_on_missing = true } }

Expand Down Expand Up @@ -190,8 +191,6 @@
end

context 'when merge_hash_arrays options' do
before { Config.reset }

context 'is set to true' do
before { Config.setup { |cfg|
cfg.overwrite_arrays = false
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def self.reset
self.overwrite_arrays = true
self.schema = nil
self.validation_contract = nil
self.fail_on_missing = false
instance_variable_set(:@_ran_once, false)
end
end
Expand Down

0 comments on commit c53194d

Please sign in to comment.