File: env.rb

package info (click to toggle)
ruby-vcr 6.0.0%2Breally5.0.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,320 kB
  • sloc: ruby: 8,456; sh: 177; makefile: 7
file content (46 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require 'bundler'
Bundler.setup

ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"

require 'aruba/cucumber'
require 'aruba/jruby' if RUBY_PLATFORM == 'java'

gem_specs = Bundler.load.specs
load_paths = Dir.glob(gem_specs.map { |spec|
  if spec.respond_to?(:lib_dirs_glob)
    spec.lib_dirs_glob
  else
    spec.load_paths
  end
}.flatten)

load_paths << File.expand_path("../../../spec", __FILE__)
rubyopt = "-rsupport/cucumber_helpers"

if RUBY_VERSION > '1.9'
  load_paths.unshift(".")
  rubyopt = "--disable-gems #{rubyopt}" unless "rbx" == ruby_engine
end

Before do
  @aruba_timeout_seconds = 30
  if "jruby" == ruby_engine
    @aruba_io_wait_seconds = 0.1
  else
    @aruba_io_wait_seconds = 0.02
  end
end

Before("~@with-bundler") do
  set_env("RUBYLIB", load_paths.join(":"))
  set_env("RUBYOPT", rubyopt)
  set_env("RBXOPT", "--disable-gems #{ENV["RBXOPT"]}") if "rbx" == ruby_engine
  set_env("GEM_HOME", nil)
end

Before("@with-bundler") do
  set_env("RUBYLIB", ".:#{ENV["RUBYLIB"]}:#{load_paths.last}")
  set_env("RUBYOPT", "#{ENV["RUBYOPT"]} -rsupport/cucumber_helpers")
  set_env("BUNDLE_GEMFILE", Bundler.default_gemfile.expand_path.to_s)
end