Sha256: 9faee2359cca3e6314a61be87e3f3c6f2a16501693424cf662207686b2492431

Contents?: true

Size: 1.82 KB

Versions: 9

Compression:

Stored size: 1.82 KB

Contents

require 'rubygems' if RUBY_VERSION.to_f < 1.9

require 'rspec/support/spec'

module ArubaLoader
  extend RSpec::Support::WithIsolatedStdErr
  with_isolated_stderr do
    require 'aruba/api'
  end
end

class << RSpec
  attr_writer :configuration, :world
end

if RUBY_PLATFORM == 'java'
  # Works around https://jira.codehaus.org/browse/JRUBY-5678
  require 'fileutils'
  ENV['TMPDIR'] = File.expand_path('../../tmp', __FILE__)
  FileUtils.mkdir_p(ENV['TMPDIR'])
end

$rspec_core_without_stderr_monkey_patch = RSpec::Core::Configuration.new

class RSpec::Core::Configuration
  def self.new(*args, &block)
    super.tap do |config|
      # We detect ruby warnings via $stderr,
      # so direct our deprecations to $stdout instead.
      config.deprecation_stream = $stdout
    end
  end
end

Dir['./spec/support/**/*.rb'].map {|f| require f}

module EnvHelpers
  def with_env_vars(vars)
    original = ENV.to_hash
    vars.each { |k, v| ENV[k] = v }

    begin
      yield
    ensure
      ENV.replace(original)
    end
  end

  def without_env_vars(*vars)
    original = ENV.to_hash
    vars.each { |k| ENV.delete(k) }

    begin
      yield
    ensure
      ENV.replace(original)
    end
  end
end

RSpec.configure do |c|
  # structural
  c.alias_it_behaves_like_to 'it_has_behavior'
  c.include(RSpecHelpers)
  c.include Aruba::Api, :file_path => /spec\/command_line/

  c.expect_with :rspec do |expectations|
    expectations.syntax = :expect
  end

  c.mock_with :rspec do |mocks|
    mocks.syntax = :expect
  end

  # runtime options
  c.raise_errors_for_deprecations!
  c.color = true
  c.include EnvHelpers
  c.filter_run_excluding :ruby => lambda {|version|
    case version.to_s
    when "!jruby"
      RUBY_ENGINE == "jruby"
    when /^> (.*)/
      !(RUBY_VERSION.to_s > $1)
    else
      !(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
    end
  }
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
opal-rspec-0.6.2 rspec-core/spec/spec_helper.rb
opal-rspec-0.6.1 rspec-core/spec/spec_helper.rb
opal-rspec-0.6.0 rspec-core/spec/spec_helper.rb
opal-rspec-0.6.0.beta1 rspec-core/spec/spec_helper.rb
opal-connect-rspec-0.5.0 rspec-core/spec/spec_helper.rb
opal-rspec-0.5.0 rspec-core/spec/spec_helper.rb
opal-rspec-0.5.0.beta3 rspec-core/spec/spec_helper.rb
opal-rspec-0.5.0.beta2 rspec-core/spec/spec_helper.rb
opal-rspec-0.5.0.beta1 rspec-core/spec/spec_helper.rb