test/acceptance/helper.rb in spring-1.1.0.beta2 vs test/acceptance/helper.rb in spring-1.1.0.beta3

- old
+ new

@@ -60,21 +60,25 @@ def log_file_path path("tmp/spring.log") end def log_file - @log_file ||= log_file_path.open("w+") + @log_file ||= begin + tmp = path("tmp") + tmp.mkdir unless tmp.exist? + tmp.join("spring.log").open("w+") + end end def env @env ||= { "GEM_HOME" => gem_home.to_s, "GEM_PATH" => "", "HOME" => user_home.to_s, "RAILS_ENV" => nil, "RACK_ENV" => nil, - "SPRING_LOG" => log_file_path.to_s + "SPRING_LOG" => log_file.path } end def path(addition) root.join addition @@ -256,17 +260,18 @@ def root "#{TEST_ROOT}/apps/rails-#{version.major}-#{version.minor}-spring-#{Spring::VERSION}" end def system(command) - Kernel.system("#{command} > /dev/null") or raise "command failed: #{command}" - end + if ENV["SPRING_DEBUG"] + puts "$ #{command}\n" + else + command = "#{command} > /dev/null" + end - def bundle - return if @bundled - application.bundle - @bundled = true + Kernel.system(command) or raise "command failed: #{command}" + puts if ENV["SPRING_DEBUG"] end # Sporadic SSL errors keep causing test failures so there are anti-SSL workarounds here def generate Bundler.with_clean_env do @@ -293,36 +298,35 @@ if application.path("bin").exist? FileUtils.cp_r(application.path("bin"), application.path("bin_original")) end end - bundle + install_spring + application.run! "bundle exec rails g scaffold post title:string" application.run! "bundle exec rake db:migrate db:test:clone" end def generate_if_missing generate unless application.exists? end def install_spring - unless @installed - # Need to do this here too because the app may have been generated with - # a different ruby - bundle + return if @installed - system("gem build spring.gemspec 2>/dev/null") - application.run! "gem install ../../../spring-#{Spring::VERSION}.gem", timeout: nil + system("gem build spring.gemspec 2>&1") + application.run! "gem install ../../../spring-#{Spring::VERSION}.gem", timeout: nil - FileUtils.rm_rf application.path("bin") + application.bundle - if application.path("bin_original").exist? - FileUtils.cp_r application.path("bin_original"), application.path("bin") - end + FileUtils.rm_rf application.path("bin") - application.run! "#{application.spring} binstub --all" - @installed = true + if application.path("bin_original").exist? + FileUtils.cp_r application.path("bin_original"), application.path("bin") end + + application.run! "#{application.spring} binstub --all" + @installed = true end def copy_to(path) FileUtils.rm_rf(path.to_s) FileUtils.cp_r(application.root.to_s, path.to_s)