Sha256: 3249ff4ea1f0d5d7a1bc3a5e15b48f08944dee2bf9b6376e39366ce43dff8e15

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

if ENV['COVERAGE'] == 'yes'
  require 'simplecov'
  require 'simplecov-console'
  require 'codecov'

  SimpleCov.formatters = [
    SimpleCov::Formatter::HTMLFormatter,
    SimpleCov::Formatter::Console,
    SimpleCov::Formatter::Codecov,
  ]
  SimpleCov.start do
    track_files 'lib/**/*.rb'

    add_filter 'lib/puppetlabs_spec_helper/version.rb'

    add_filter '/spec'

    # do not track vendored files
    add_filter '/vendor'
    add_filter '/.vendor'
  end
end

require 'fakefs/spec_helpers'

FakeFS::Pathname.class_eval do
  def symlink?
    File.symlink?(@path)
  end
end

require 'puppetlabs_spec_helper/puppet_spec_helper'
require 'puppetlabs_spec_helper/puppetlabs_spec/puppet_internals'
require 'puppetlabs_spec_helper/rake_tasks'

RSpec.shared_context 'with a rake task', type: :task do
  subject(:task) { Rake::Task[task_name] }

  include FakeFS::SpecHelpers

  let(:task_name) { self.class.top_level_description.sub(%r{\Arake }, '') }
end

# configure RSpec after including all the code
RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  config.include_context 'with a rake task', type: :task
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppetlabs_spec_helper-5.0.3 spec/spec_helper.rb
puppetlabs_spec_helper-5.0.2 spec/spec_helper.rb
puppetlabs_spec_helper-5.0.1 spec/spec_helper.rb
puppetlabs_spec_helper-5.0.0 spec/spec_helper.rb