class RubyMemcheck::RSpec::RakeTask

def initialize(*args)

def initialize(*args)
  @configuration =
    if !args.empty? && args[0].is_a?(Configuration)
      args.shift
    else
      RubyMemcheck.default_configuration
    end
  super
end

def run_task(verbose)

def run_task(verbose)
  error = nil
  @reporter = TestTaskReporter.new(configuration)
  @reporter.run_ruby_with_valgrind do
    # RSpec::Core::RakeTask#run_task calls Kernel.exit on failure
    super
  rescue SystemExit => e
    error = e
  end
  raise error if error
end

def spec_command

def spec_command
  # First part of command is Ruby
  args = super.split(" ")[1..]
  configuration.command(args)
end