Skip to content

Commit 839bce4

Browse files
committed
experiment! Bring back shims around aruba to its previous state for
older Rails
1 parent 45a1451 commit 839bce4

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

features/support/env.rb

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,27 @@
22
require 'fileutils'
33

44
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)
1226
end
1327
end
1428
end
@@ -41,12 +55,18 @@ def env_to_h
4155
end
4256
end
4357

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
4866
end
4967

68+
World(ArubaExt)
69+
5070
unless File.directory?('./tmp/example_app')
5171
system "rake generate:app generate:stuff"
5272
end

0 commit comments

Comments
 (0)