free_mutant/spec/spec_helper.rb
Markus Schirp d647563055 Refactor expression parsing and representation
* Avoids boot time mutation of REGISTER constant
* Allows to define project specific expression parsing
* Avoids custom (slow) serialization of Expression objects speeding up
  reporter / killer IPC
* Improve specification
* Improve integration API as it now finally references an object the config
* Allow reproduction of syntax from Expression#syntax
* Allow instantiation of Expresssion objects without generating the
  syntax, much nicer for most specs & internal code, avoids generating
  a string to parse it into an expression
* Fix LSP violation in Mutant::Matcher namespace
2015-06-21 14:44:33 +00:00

67 lines
1.5 KiB
Ruby

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'
add_filter 'lib/mutant/meta/*'
add_filter 'lib/mutant/zombifier'
add_filter 'lib/mutant/zombifier/*'
# Trace points shadow each other under 2.0 (fixed in 2.1)
add_filter 'lib/mutant/line_trace.rb' if RUBY_VERSION.eql?('2.0.0')
minimum_coverage 100
end
end
require 'tempfile'
require 'concord'
require 'anima'
require 'adamantium'
require 'devtools/spec_helper'
require 'unparser/cli'
require 'mutant'
require 'mutant/meta'
Devtools.init_spec_helper
$LOAD_PATH << File.join(TestApp.root, 'lib')
require 'test_app'
module Fixtures
TEST_CONFIG = Mutant::Config::DEFAULT.update(reporter: Mutant::Reporter::Trace.new)
TEST_CACHE = Mutant::Cache.new
TEST_ENV = Mutant::Env::Bootstrap.(TEST_CONFIG, TEST_CACHE)
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
end
module MessageHelper
def message(*arguments)
Mutant::Actor::Message.new(*arguments)
end
end
RSpec.configure do |config|
config.extend(SharedContext)
config.include(CompressHelper)
config.include(MessageHelper)
config.include(ParserHelper)
config.include(Mutant::AST::Sexp)
end