Skip to content

Instantly share code, notes, and snippets.

@mockdeep
Created October 16, 2013 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mockdeep/7014387 to your computer and use it in GitHub Desktop.
Save mockdeep/7014387 to your computer and use it in GitHub Desktop.
mutant rake script
# encoding: utf-8
# Eager load application and dependencies
require File.expand_path('../../../config/environment', __FILE__)
Rails.application.eager_load!
# All classes to mutate
classes = ActiveSupport::Dependencies.autoloaded_constants.
map(&:constantize).grep(Class).map(&:name)
# Remove classes that should not be mutation covered
classes -= %w[ InheritedResources::Base ]
# Load all rake tasks
Rake.application.load_imports
# Remove metrics:mutant from devtools
task('metrics:mutant').clear
namespace :metrics do
require 'mutant'
desc 'Run mutant'
task :mutant do
p classes
status = Mutant::CLI.run([*classes, '--rspec'])
if status.nonzero?
raise 'Mutant task is not successful'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment