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'
|
2014-06-05 17:45:49 +00:00
|
|
|
add_filter 'lib/mutant/meta/*'
|
2014-07-06 03:02:24 +00:00
|
|
|
add_filter 'lib/mutant/zombifier'
|
|
|
|
add_filter 'lib/mutant/zombifier/*'
|
2014-12-07 21:40:49 +00:00
|
|
|
# Trace points shadow each other under 2.0 (fixed in 2.1)
|
2014-12-22 18:57:25 +00:00
|
|
|
add_filter 'lib/mutant/line_trace.rb' if RUBY_VERSION.eql?('2.0.0')
|
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
|
|
|
|
|
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'
|
2014-08-10 15:06:09 +00:00
|
|
|
Devtools.init_spec_helper
|
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
|
2014-07-06 03:07:20 +00:00
|
|
|
TEST_CONFIG = Mutant::Config::DEFAULT.update(reporter: Mutant::Reporter::Trace.new)
|
|
|
|
TEST_CACHE = Mutant::Cache.new
|
2015-06-21 14:44:33 +00:00
|
|
|
TEST_ENV = Mutant::Env::Bootstrap.(TEST_CONFIG, TEST_CACHE)
|
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
|
2013-06-04 19:22:33 +02:00
|
|
|
end
|
|
|
|
|
2014-10-23 11:37:53 +00:00
|
|
|
module MessageHelper
|
|
|
|
def message(*arguments)
|
|
|
|
Mutant::Actor::Message.new(*arguments)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-31 00:48:04 +02:00
|
|
|
RSpec.configure do |config|
|
2014-10-23 11:37:53 +00:00
|
|
|
config.extend(SharedContext)
|
2012-08-16 18:02:03 +02:00
|
|
|
config.include(CompressHelper)
|
2014-10-23 11:37:53 +00:00
|
|
|
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)
|
2012-07-23 16:37:44 +02:00
|
|
|
end
|