|
2 | 2 | require 'fileutils'
|
3 | 3 |
|
4 | 4 | module ArubaExt
|
5 |
| - def run_command(cmd, timeout = nil) |
6 |
| - exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd |
7 |
| - unset_bundler_env_vars |
8 |
| - # Ensure the correct Gemfile and binstubs are found |
9 |
| - in_current_directory do |
10 |
| - with_unbundled_env do |
11 |
| - super(exec_cmd, timeout) |
| 5 | + if defined?(Aruba::VERSION) && Aruba::VERSION >= '0.14.12' |
| 6 | + def run_command(cmd, timeout = nil) |
| 7 | + exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd |
| 8 | + unset_bundler_env_vars |
| 9 | + # Ensure the correct Gemfile and binstubs are found |
| 10 | + in_current_directory do |
| 11 | + with_unbundled_env do |
| 12 | + super(exec_cmd, timeout) |
| 13 | + end |
| 14 | + end |
| 15 | + end |
| 16 | + else |
| 17 | + def run(cmd, timeout = nil) |
| 18 | + exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd |
| 19 | + super(exec_cmd, timeout) |
| 20 | + end |
| 21 | + # This method overrides Aruba 0.5.4 implementation so that we can reset Bundler to use the sample app Gemfile |
| 22 | + def in_current_dir(&block) |
| 23 | + Bundler.with_clean_env do |
| 24 | + _mkdir(current_dir) |
| 25 | + Dir.chdir(current_dir, &block) |
12 | 26 | end
|
13 | 27 | end
|
14 | 28 | end
|
@@ -41,12 +55,18 @@ def env_to_h
|
41 | 55 | end
|
42 | 56 | end
|
43 | 57 |
|
44 |
| -World(ArubaExt) |
45 |
| - |
46 |
| -Aruba.configure do |config| |
47 |
| - config.exit_timeout = 30 |
| 58 | +if defined?(Aruba::VERSION) && Aruba::VERSION >= '0.14.12' |
| 59 | + Aruba.configure do |config| |
| 60 | + config.exit_timeout = 30 |
| 61 | + end |
| 62 | +else |
| 63 | + Before do |
| 64 | + @aruba_timeout_seconds = 30 |
| 65 | + end |
48 | 66 | end
|
49 | 67 |
|
| 68 | +World(ArubaExt) |
| 69 | + |
50 | 70 | unless File.directory?('./tmp/example_app')
|
51 | 71 | system "rake generate:app generate:stuff"
|
52 | 72 | end
|
|
0 commit comments