free_mutant/spec/spec_helper.rb

72 lines
1.5 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-09-12 09:15:43 -04:00
2013-07-28 18:44:26 -04:00
if ENV['COVERAGE'] == 'true'
require 'simplecov'
SimpleCov.start do
command_name 'spec:unit'
add_filter 'config'
add_filter 'spec'
add_filter 'vendor'
add_filter 'test_app'
2016-02-14 16:11:32 -05:00
add_filter 'lib/mutant.rb' # simplecov bug not seeing default block is executed
2014-10-23 07:37:53 -04:00
minimum_coverage 100
2013-07-28 18:44:26 -04:00
end
end
# Require warning support first in order to catch any warnings emitted during boot
require_relative './support/warning'
$stderr = MutantSpec::Warning::EXTRACTOR
require 'tempfile'
require 'concord'
require 'anima'
require 'adamantium'
require 'devtools/spec_helper'
require 'unparser/cli'
2013-06-04 16:16:04 -04:00
require 'mutant'
require 'mutant/meta'
$LOAD_PATH << File.join(TestApp.root, 'lib')
2012-08-14 16:45:34 -04:00
require 'test_app'
module Fixtures
TEST_CONFIG = Mutant::Config::DEFAULT.with(reporter: Mutant::Reporter::Null.new)
TEST_ENV = Mutant::Env::Bootstrap.(TEST_CONFIG)
end # Fixtures
module ParserHelper
def generate(node)
Unparser.unparse(node)
end
def parse(string)
Unparser::Preprocessor.run(Parser::CurrentRuby.parse(string))
end
def parse_expression(string)
Mutant::Config::DEFAULT.expression_parser.(string)
end
2016-04-10 17:33:47 -04:00
end # ParserHelper
2014-10-23 07:37:53 -04:00
module MessageHelper
def message(*arguments)
Mutant::Actor::Message.new(*arguments)
end
2016-04-10 17:33:47 -04:00
end # MessageHelper
2014-10-23 07:37:53 -04:00
RSpec.configure do |config|
2014-10-23 07:37:53 -04:00
config.extend(SharedContext)
config.include(MessageHelper)
config.include(ParserHelper)
config.include(Mutant::AST::Sexp)
config.after(:suite) do
$stderr = STDERR
MutantSpec::Warning.assert_no_warnings
end
end