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