features/support/env.rb in lolcommits-0.4.1pre2 vs features/support/env.rb in lolcommits-0.4.1

- old
+ new

@@ -2,10 +2,12 @@ require 'methadone/cucumber' require 'open3' require 'test/unit/assertions' include Test::Unit::Assertions require 'faker' +require 'lolcommits/configuration' +include Lolcommits ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}" LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib') Before do @@ -47,7 +49,46 @@ After('@fake-interactive-rebase') do ENV['GIT_EDITOR'] = @original_git_editor end Before('@slow_process') do - @aruba_io_wait_seconds = 3 + @aruba_io_wait_seconds = 5 + @aruba_timeout_seconds = 60 end + +# adjust the path so tests dont see a global imagemagick install +Before('@fake-no-imagemagick') do + + # make a new subdir that still contains git and mplayer + tmpbindir = File.expand_path(File.join @dirs, "bin") + FileUtils.mkdir_p tmpbindir + ["git","mplayer"].each do |cmd| + whichcmd = Lolcommits::Configuration.command_which(cmd) + unless whichcmd.nil? + FileUtils.ln_s whichcmd, File.join(tmpbindir, File.basename(whichcmd)) + end + end + + # use a modified version of Configuration::command_which to detect where IM is installed + # and remove that from the path + cmd = 'mogrify' + exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] + newpaths = ENV['PATH'].split(File::PATH_SEPARATOR).reject do |path| + found_cmd = false + exts.each { |ext| + exe = "#{path}/#{cmd}#{ext}" + found_cmd = true if File.executable? exe + } + found_cmd + end + + # add the temporary directory with git in it back into the path + newpaths << tmpbindir + + @original_path = ENV['PATH'] + ENV['PATH'] = newpaths.join(File::PATH_SEPARATOR) + puts ENV['PATH'] +end + +After('@fake-no-imagemagick') do + ENV['PATH'] = @original_path +end \ No newline at end of file