2013-07-28 18:44:26 -04:00
|
|
|
if ENV['COVERAGE'] == 'true'
|
|
|
|
require 'simplecov'
|
|
|
|
|
|
|
|
SimpleCov.start do
|
2013-09-09 01:34:37 -04:00
|
|
|
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
|
2013-09-09 01:34:37 -04:00
|
|
|
|
2014-10-23 07:37:53 -04:00
|
|
|
minimum_coverage 100
|
2013-07-28 18:44:26 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-06-26 23:15:37 -04: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 17:34:33 -04:00
|
|
|
require 'tempfile'
|
2014-04-11 21:12:49 -04:00
|
|
|
require 'concord'
|
2015-06-06 18:29:47 -04:00
|
|
|
require 'anima'
|
2014-04-11 21:12:49 -04:00
|
|
|
require 'adamantium'
|
2013-12-29 17:36:55 -05:00
|
|
|
require 'devtools/spec_helper'
|
2014-04-11 21:12:49 -04:00
|
|
|
require 'unparser/cli'
|
2013-06-04 16:16:04 -04:00
|
|
|
require 'mutant'
|
2014-06-02 08:57:14 -04:00
|
|
|
require 'mutant/meta'
|
2012-07-23 10:37:44 -04:00
|
|
|
|
2013-07-28 15:16:45 -04:00
|
|
|
$LOAD_PATH << File.join(TestApp.root, 'lib')
|
2012-08-14 06:27:56 -04:00
|
|
|
|
2012-08-14 16:45:34 -04:00
|
|
|
require 'test_app'
|
2012-07-26 13:25:23 -04:00
|
|
|
|
2013-06-27 16:18:07 -04:00
|
|
|
module Fixtures
|
2015-11-15 20:21:57 -05:00
|
|
|
TEST_CONFIG = Mutant::Config::DEFAULT.with(reporter: Mutant::Reporter::Null.new)
|
2015-11-12 23:47:47 -05:00
|
|
|
TEST_ENV = Mutant::Env::Bootstrap.(TEST_CONFIG)
|
2014-06-30 09:06:57 -04:00
|
|
|
end # Fixtures
|
2013-06-27 16:18:07 -04:00
|
|
|
|
2013-06-04 13:22:33 -04:00
|
|
|
module ParserHelper
|
|
|
|
def generate(node)
|
|
|
|
Unparser.unparse(node)
|
|
|
|
end
|
|
|
|
|
|
|
|
def parse(string)
|
2014-04-22 13:04:25 -04:00
|
|
|
Unparser::Preprocessor.run(Parser::CurrentRuby.parse(string))
|
2013-06-04 13:22:33 -04:00
|
|
|
end
|
2015-06-21 10:44:33 -04:00
|
|
|
|
|
|
|
def parse_expression(string)
|
|
|
|
Mutant::Config::DEFAULT.expression_parser.(string)
|
|
|
|
end
|
2016-04-10 17:33:47 -04:00
|
|
|
end # ParserHelper
|
2013-06-04 13:22:33 -04:00
|
|
|
|
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
|
|
|
|
2012-07-30 18:48:04 -04:00
|
|
|
RSpec.configure do |config|
|
2014-10-23 07:37:53 -04:00
|
|
|
config.extend(SharedContext)
|
2012-08-16 12:02:03 -04:00
|
|
|
config.include(CompressHelper)
|
2014-10-23 07:37:53 -04:00
|
|
|
config.include(MessageHelper)
|
2013-06-04 13:22:33 -04:00
|
|
|
config.include(ParserHelper)
|
2014-06-29 17:25:17 -04:00
|
|
|
config.include(Mutant::AST::Sexp)
|
2016-06-26 23:15:37 -04:00
|
|
|
|
|
|
|
config.after(:suite) do
|
|
|
|
$stderr = STDERR
|
|
|
|
MutantSpec::Warning.assert_no_warnings
|
|
|
|
end
|
2012-07-23 10:37:44 -04:00
|
|
|
end
|