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'
|
2014-06-05 13:45:49 -04:00
|
|
|
add_filter 'lib/mutant/meta/*'
|
2014-07-05 23:02:24 -04:00
|
|
|
add_filter 'lib/mutant/zombifier'
|
|
|
|
add_filter 'lib/mutant/zombifier/*'
|
2014-12-07 16:40:49 -05:00
|
|
|
# Trace points shadow each other under 2.0 (fixed in 2.1)
|
2014-12-22 13:57:25 -05:00
|
|
|
add_filter 'lib/mutant/line_trace.rb' if RUBY_VERSION.eql?('2.0.0')
|
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
|
|
|
|
|
2014-10-24 17:34:33 -04:00
|
|
|
require 'tempfile'
|
2014-04-11 21:12:49 -04:00
|
|
|
require 'concord'
|
|
|
|
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'
|
2014-08-10 11:06:09 -04:00
|
|
|
Devtools.init_spec_helper
|
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
|
2014-07-05 23:07:20 -04:00
|
|
|
TEST_CONFIG = Mutant::Config::DEFAULT.update(reporter: Mutant::Reporter::Trace.new)
|
|
|
|
TEST_CACHE = Mutant::Cache.new
|
2014-12-22 09:42:20 -05:00
|
|
|
TEST_ENV = Mutant::Env::Bootstrap.call(TEST_CONFIG, TEST_CACHE)
|
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
|
|
|
|
end
|
|
|
|
|
2014-10-23 07:37:53 -04:00
|
|
|
module MessageHelper
|
|
|
|
def message(*arguments)
|
|
|
|
Mutant::Actor::Message.new(*arguments)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
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)
|
2012-07-23 10:37:44 -04:00
|
|
|
end
|