diff --git a/Guardfile b/Guardfile index dab8842ab..6a8620807 100644 --- a/Guardfile +++ b/Guardfile @@ -2,33 +2,15 @@ guard :bundler do watch('Gemfile') - watch('Gemfile.lock') - watch(%w{.+.gemspec\z}) end -guard :rspec, cli: File.read('.rspec').split.push('--fail-fast').join(' '), keep_failed: false do - # Run all specs if configuration is modified - watch('.rspec') { 'spec' } - watch('Guardfile') { 'spec' } - watch('Gemfile.lock') { 'spec' } - watch('spec/spec_helper.rb') { 'spec' } +guard :rspec, :all_after_pass => false, :all_on_start => false, :cmd => 'bundle exec rspec --fail-fast --seed 0' do + # run all specs if the spec_helper or supporting files files are modified + watch('spec/spec_helper.rb') { 'spec/unit' } + watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec/unit' } - # Run all specs if supporting files files are modified - watch(%r{\Aspec/(?:fixtures|lib|support|shared)/.+\.rb\z}) { 'spec' } + watch(%r{lib/.*.rb}) { 'spec/unit' } - # Run unit specs if associated lib code is modified - watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}*"] } - watch(%r{\Alib/(.+)/support/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}/#{m[2]}*"] } - watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' } - - # Run a spec if it is modified - watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z}) + # run a spec if it is modified + watch(%r{\Aspec/.+_spec\.rb\z}) end - -# Deactivated for now. Somehow it disables the rspec guard. -# -# guard :rubocop, cli: %w[--config config/rubocop.yml] do -# watch(%r{.+\.(?:rb|rake)\z}) -# watch(%r{\Aconfig/rubocop\.yml\z}) { |m| File.dirname(m[0]) } -# watch(%r{(?:.+/)?\.rubocop\.yml\z}) { |m| File.dirname(m[0]) } -# end diff --git a/lib/mutant.rb b/lib/mutant.rb index 1f227620d..bedb762e7 100644 --- a/lib/mutant.rb +++ b/lib/mutant.rb @@ -32,6 +32,7 @@ module Mutant require 'mutant/singleton_methods' require 'mutant/constants' require 'mutant/random' +require 'mutant/walker' require 'mutant/predicate' require 'mutant/predicate/attribute' require 'mutant/predicate/whitelist' diff --git a/lib/mutant/cli.rb b/lib/mutant/cli.rb index 105f06b02..f5ceab5c7 100644 --- a/lib/mutant/cli.rb +++ b/lib/mutant/cli.rb @@ -43,6 +43,7 @@ def self.run(arguments) def initialize(arguments = []) @filters, @matchers = [], [] @debug = @fail_fast = @zombie = false + @expect_coverage = 100.0 @strategy = Strategy::Null.new @cache = Mutant::Cache.new parse(arguments) @@ -64,7 +65,8 @@ def config subject_predicate: @subject_predicate.output, strategy: @strategy, fail_fast: @fail_fast, - reporter: reporter + reporter: reporter, + expect_coverage: @expect_coverage ) end memoize :config