#!/usr/bin/env ruby

# This is necessary for when `--standalone` is being used.
$:.unshift File.expand_path '../../bundle', __FILE__
require 'bundler/setup'

# To use simplecov while running rspec-core's test suite, we must
# load simplecov _before_ loading any of rspec-core's files.
# So, this executable exists purely as a wrapper script that
# first loads simplecov, and then loads rspec.
begin
  # Simplecov emits some ruby warnings when loaded, so silence them.
  old_verbose, $VERBOSE = $VERBOSE, false

  unless ENV['NO_COVERAGE'] || RUBY_VERSION < '1.9.3'
    require 'simplecov'

    SimpleCov.start do
      add_filter "./bundle/"
      add_filter "./tmp/"
      add_filter "./spec/"
      minimum_coverage(RUBY_PLATFORM == 'java' ? 94 : 97)
    end
  end
rescue LoadError
ensure
  $VERBOSE = old_verbose
end

load File.expand_path("../../exe/rspec", __FILE__)
