Class: PoiseBoiler::Helpers::SpecHelper
- Inherits:
-
Halite::HelperBase
- Object
- Halite::HelperBase
- PoiseBoiler::Helpers::SpecHelper
- Defined in:
- lib/poise_boiler/helpers/spec_helper.rb
Overview
Helper for a spec_helper.rb to configure things for the Poise workflow. This configures rspec, rspec-its, simplecov (with codeclimate and codecov if possible), and the Halite spec helper.
Instance Method Summary collapse
Instance Method Details
#install ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/poise_boiler/helpers/spec_helper.rb', line 28 def install require 'rspec' require 'rspec/its' require 'simplecov' require 'pry' require 'pry-byebug' require 'chefspec' # Check for coverage stuffs formatters = [] if ENV['CODECLIMATE_REPO_TOKEN'] require 'codeclimate-test-reporter' formatters << CodeClimate::TestReporter::Formatter end if ENV['CODECOV_TOKEN'] || ENV['TRAVIS'] require 'codecov' formatters << SimpleCov::Formatter::Codecov end unless formatters.empty? SimpleCov.formatters = formatters end SimpleCov.start do # Don't get coverage on the test cases themselves. add_filter '/spec/' add_filter '/test/' # Codecov doesn't automatically ignore vendored files. add_filter '/vendor/' end RSpec.configure do |config| # Basic configuraiton config.run_all_when_everything_filtered = true config.filter_run(:focus) unless ENV['CI'] # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 config.order = 'random' unless ['no_halite'] require 'halite/spec_helper' config.include Halite::SpecHelper(gem_name ? gemspec : nil) # Hide the spec helper from RSpec traces by default. config.backtrace_exclusion_patterns << %r{/halite/spec_helper} # In verbose mode, set Chef to log level debug by default. if ENV['DEBUG'] config.before { [:log_level] ||= :debug } end end end end |