Skip to content

Commit 6916a29

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

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

features/support/env.rb

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,28 @@
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
1214
end
1315
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)
26+
end
1427
end
1528

1629
def unset_bundler_env_vars
@@ -41,12 +54,18 @@ def env_to_h
4154
end
4255
end
4356

44-
World(ArubaExt)
45-
46-
Aruba.configure do |config|
47-
config.exit_timeout = 30
57+
if defined?(Aruba::VERSION) && Aruba::VERSION >= '0.14.12'
58+
Aruba.configure do |config|
59+
config.exit_timeout = 30
60+
end
61+
else
62+
Before do
63+
@aruba_timeout_seconds = 30
64+
end
4865
end
4966

67+
World(ArubaExt)
68+
5069
unless File.directory?('./tmp/example_app')
5170
system "rake generate:app generate:stuff"
5271
end

0 commit comments

Comments
 (0)