summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 6f3d7e2..ffbde8a 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -3,10 +3,6 @@ $:.push File.join(File.dirname(__FILE__), "..", "lib")
require "mixlib/cli"
-class TestCLI
- include Mixlib::CLI
-end
-
RSpec.configure do |config|
# Use documentation format
config.formatter = "doc"
@@ -23,4 +19,12 @@ RSpec.configure do |config|
config.filter_run focus: true
config.run_all_when_everything_filtered = true
config.warnings = true
+
+ config.before(:each) do
+ # create a fresh TestCLI class on every example, so that examples never
+ # pollute global variables and create ordering issues
+ Object.send(:remove_const, "TestCLI") if Object.const_defined?("TestCLI")
+ TestCLI = Class.new
+ TestCLI.send(:include, Mixlib::CLI)
+ end
end