Sha256: d6e2b180b69e54688c2fe4db79d8e3b22e0dfe4734d2d71c6e3f0c7b6d771a42

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

require 'simplecov'

SimpleCov.start do
  add_filter '/spec/'

  enable_coverage :branch
  primary_coverage :branch
end

require 'mina'
require 'rspec'
require 'pry'
require 'set'

Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
Rake.application = Mina::Application.new
Dir['./tasks/mina/**/*.rb'].sort.each { |f| require f }

RSpec.configure do |config|
  config.include RakeExampleGroup, type: :rake

  config.raise_errors_for_deprecations!
  config.order = 'random'

  initial_task_names = Rake.application.tasks.to_set(&:name)
  initial_variables = Mina::Configuration.instance.variables

  config.before do
    Mina::Configuration.instance.instance_variable_set(:@variables, initial_variables.clone)
  end

  config.after do
    Rake.application.tasks.each(&:reenable)
    Rake.application.instance_variable_get(:@tasks).keep_if { |task_name, _| initial_task_names.include?(task_name) }
  end

  config.around(:each, :suppressed_output) do |example|
    original_stdout, $stdout = $stdout, File.open(File::NULL, 'w')
    original_stderr, $stderr = $stderr, File.open(File::NULL, 'w')

    example.run

    $stdout, $stderr = original_stdout, original_stderr
  end

  config.around do |example|
    example.run
  rescue SystemExit
    raise "Unhandled system exit (you're probably missing a raise_error(SystemExit) matcher somewhere)"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mina-1.2.5 spec/spec_helper.rb