Skip to content

Commit 5781ea1

Browse files
committed
Use the previous aruba for older Rails
https://github.com/rspec/rspec-rails/pull/2140/files#diff-73c25cf975ccb4c89d8659202506c353L58 bumped aruba from 0.5.4 straight to 0.14.12. Using the version that used to work for older rails.
1 parent 6e6a144 commit 5781ea1

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
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

rspec-rails.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Gem::Specification.new do |s|
5353
s.add_development_dependency 'cucumber', '~> 1.3.5'
5454
if ENV['RAILS_VERSION'].gsub(/[^\d\.-]/, '').tr('-', '.') < '4.0'
5555
# aruba > 0.9 depends on thor ~> 0.19, while railties < 4.0 depend on thor ~> 0.14.6
56-
s.add_development_dependency 'aruba', '~> 0.8.1'
56+
s.add_development_dependency 'aruba', '~> 0.5.4'
5757
else
5858
s.add_development_dependency 'aruba', '~> 0.14.12'
5959
end

0 commit comments

Comments
 (0)