summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
blob: ffbde8a631a254c2d31ee5973d6021d5d8f73ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$TESTING = true
$:.push File.join(File.dirname(__FILE__), "..", "lib")

require "mixlib/cli"

RSpec.configure do |config|
  # Use documentation format
  config.formatter = "doc"

  # Use color in STDOUT
  config.color = true

  # Use color not only in STDOUT but also in pagers and files
  config.tty = true

  # run the examples in random order
  config.order = :rand

  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