features/support/env.rb in lolcommits-0.10.0 vs features/support/env.rb in lolcommits-0.11.0.pre
- old
+ new
@@ -7,37 +7,40 @@
require File.join(__dir__, 'path_helpers')
include Lolcommits
World(PathHelpers)
-Before do
- @aruba_timeout_seconds = 20
+Aruba.configure do |config|
+ config.exit_timeout = 20
+end
+Before do
# prevent launchy from opening gifs in tests
- set_env 'LAUNCHY_DRY_RUN', 'true'
- set_env 'LOLCOMMITS_CAPTURER', 'Lolcommits::CaptureFake'
+ set_environment_variable 'LAUNCHY_DRY_RUN', 'true'
+ set_environment_variable 'LOLCOMMITS_CAPTURER', 'Lolcommits::CaptureFake'
author_name = 'Testy McTesterson'
author_email = 'testy@tester.com'
- set_env 'GIT_AUTHOR_NAME', author_name
- set_env 'GIT_COMMITTER_NAME', author_name
- set_env 'GIT_AUTHOR_EMAIL', author_email
- set_env 'GIT_COMMITTER_EMAIL', author_email
+ set_environment_variable 'GIT_AUTHOR_NAME', author_name
+ set_environment_variable 'GIT_COMMITTER_NAME', author_name
+ set_environment_variable 'GIT_AUTHOR_EMAIL', author_email
+ set_environment_variable 'GIT_COMMITTER_EMAIL', author_email
end
# for tasks that may take an incredibly long time (e.g. network related)
# we should strive to not have any of these in our scenarios, naturally.
Before('@slow_process') do
- @aruba_io_wait_seconds = 5
- @aruba_timeout_seconds = 60
+ Aruba.configure do |config|
+ config.exit_timeout = 60
+ end
end
# in order to fake an interactive rebase, we replace the editor with a script
# to simply squash a few random commits. in this case, using lines 3-5.
Before('@fake-interactive-rebase') do
- set_env 'GIT_EDITOR', "sed -i -e '3,5 s/pick/squash/g'"
+ set_environment_variable 'GIT_EDITOR', "sed -i -e '3,5 s/pick/squash/g'"
end
# adjust the path so tests dont see a global imagemagick install
Before('@fake-no-imagemagick') do
reject_paths_with_cmd('mogrify')
@@ -46,13 +49,22 @@
# adjust the path so tests dont see a global ffmpeg install
Before('@fake-no-ffmpeg') do
reject_paths_with_cmd('ffmpeg')
end
-# do test in temporary directory so our own git repo-ness doesn't affect it
-Before('@in-tempdir') do
- @dirs = [Dir.mktmpdir]
+# do test in a new temp directory (outside our own git repo-ness)
+# due to https://github.com/cucumber/aruba/issues/478 aruba no longer allows
+# wandering out of `tmp/aruba` so this pop/restore is necessary
+Before('@no-repo-dir') do
+ @original_root = aruba.root_directory.pop
+ @original_dir = aruba.current_directory.pop
+ @working_dir = Dir.mktmpdir
+ aruba.current_directory << @working_dir
end
-After('@in-tempdir') do
- FileUtils.rm_rf(@dirs.first)
+After('@no-repo-dir') do
+ aruba.current_directory.pop
+ aruba.root_directory << @original_root
+ aruba.current_directory << @original_dir
+
+ FileUtils.rm_rf(@working_dir)
end