require File.expand_path('on_what', File.dirname(File.dirname(__FILE__)))

begin
  require 'simplecov'
  require 'coveralls'

  # On Ruby 1.9+ use SimpleCov and publish to Coveralls.io
  if !on_1_8?
    SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
      SimpleCov::Formatter::HTMLFormatter,
      Coveralls::SimpleCov::Formatter
    ]
    SimpleCov.start do
      add_filter '/spec/'    # exclude test code
      add_filter '/vendor/'  # exclude gems which are vendored on Travis CI
    end

    # Remove Docile, which was required by SimpleCov, to require again later
    Object.send(:remove_const, :Docile)
    $LOADED_FEATURES.reject! { |f| f =~ /\/docile\// }
  end
rescue LoadError
  warn 'warning: simplecov/coveralls gems not found; skipping coverage'
end

lib_dir = File.join(File.dirname(File.dirname(__FILE__)), 'lib')
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir

# Require Docile again, now with coverage enabled on 1.9+
require 'docile'

require 'singleton'
require 'rspec'

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end
end

require File.expand_path('on_what', File.dirname(File.dirname(__FILE__)))

begin
  require 'simplecov'
  require 'coveralls'

  # On Ruby 1.9+ use SimpleCov and publish to Coveralls.io
  if !on_1_8?
    SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
      SimpleCov::Formatter::HTMLFormatter,
      Coveralls::SimpleCov::Formatter
    ]
    SimpleCov.start do
      add_filter '/spec/'    # exclude test code
      add_filter '/vendor/'  # exclude gems which are vendored on Travis CI
    end

    # Remove Docile, which was required by SimpleCov, to require again later
    Object.send(:remove_const, :Docile)
    $LOADED_FEATURES.reject! { |f| f =~ /\/docile\// }
  end
rescue LoadError
  warn 'warning: simplecov/coveralls gems not found; skipping coverage'
end

lib_dir = File.join(File.dirname(File.dirname(__FILE__)), 'lib')
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir

# Require Docile again, now with coverage enabled on 1.9+
require 'docile'

require 'singleton'

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end
end

Remove explicit require of rspec to fix builds
Remove explicit require of rspec to fix builds

Not sure why this works, or is even possible? But I can reproduce locally that
all non-1.8 builds fail when using a bundler cache unless this line is removed.

My guess is that, when using the --path option to bundler, all gems are being
implicitly required, and requiring rspec a second time is somehow causing issues,
but that doesn't make much sense to me.
