Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Mutant integration #59

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ group :development do
gem 'guard'
gem 'guard-bundler'
gem 'guard-rspec'
gem 'mutant', '~> 0.5.10'
gem 'mutant-rspec', '~> 0.5.10'
end
gem 'pry'
end
Expand Down
20 changes: 20 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,23 @@ rescue LoadError
end

task :default => [:spec, :rubocop]

task :mutant => :spec do
require 'mutant'

ignores = [
# Mutation with infinite runtime
'Naught::NullClassBuilder::Commands::Pebble#call'
]

arguments = []
arguments << '--include' << 'lib'
arguments << '--require' << 'naught'
arguments << '--use' << 'rspec'
arguments << '--score' << '87.02'
arguments << 'Naught*'
ignores.each do |ignore|
arguments << '--ignore-subject' << ignore
end
fail unless Mutant::CLI.run(arguments)
end
38 changes: 31 additions & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
GEM_ROOT = File.expand_path('../../', __FILE__)
$LOAD_PATH.unshift File.join(GEM_ROOT, 'lib')

if ENV['TRAVIS']
require 'coveralls'
Coveralls.wear!
else
require 'simplecov'
SimpleCov.start
end
# if ENV['TRAVIS']
# require 'coveralls'
# Coveralls.wear!
# else
# # TODO: Renable in a guard that prevents the hooks to interfere with mutant killforks.
# # require 'simplecov'
# SimpleCov.start
# end

require 'naught'
Dir[File.join(GEM_ROOT, 'spec', 'support', '**/*.rb')].each { |f| require f }

require 'mutant'
require 'mutant-rspec'

# Monkeypatch to mutant all specs per mutation.
#
# TODO: Push this down to a configuration option.
#
module Mutant
module Rspec
class Killer
# Return all example groups
#
# @return [Enumerable<RSpec::Example>]
#
# @api private
#
def example_groups
strategy.example_groups
end
end # Rspec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. These closing comments are flipped around
  2. Are they really necessary for this small class?

end # Killer
end # Mutant