Skip to content

Commit 30a41ee

Browse files
committed
more test helper fixes
1 parent 28c591e commit 30a41ee

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

test/acceptance/helper.rb

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ def log_file_path
6262
end
6363

6464
def log_file
65-
@log_file ||= log_file_path.open("w+")
65+
@log_file ||= begin
66+
tmp = path("tmp")
67+
tmp.mkdir unless tmp.exist?
68+
tmp.join("spring.log").open("w+")
69+
end
6670
end
6771

6872
def env
@@ -72,7 +76,7 @@ def env
7276
"HOME" => user_home.to_s,
7377
"RAILS_ENV" => nil,
7478
"RACK_ENV" => nil,
75-
"SPRING_LOG" => log_file_path.to_s
79+
"SPRING_LOG" => log_file.path
7680
}
7781
end
7882

@@ -295,7 +299,8 @@ def generate
295299
end
296300
end
297301

298-
bundle
302+
install_spring
303+
299304
application.run! "bundle exec rails g scaffold post title:string"
300305
application.run! "bundle exec rake db:migrate db:test:clone"
301306
end
@@ -305,23 +310,21 @@ def generate_if_missing
305310
end
306311

307312
def install_spring
308-
unless @installed
309-
# Need to do this here too because the app may have been generated with
310-
# a different ruby
311-
bundle
313+
return if @installed
312314

313-
system("gem build spring.gemspec 2>/dev/null")
314-
application.run! "gem install ../../../spring-#{Spring::VERSION}.gem", timeout: nil
315+
system("gem build spring.gemspec 2>/dev/null")
316+
application.run! "gem install ../../../spring-#{Spring::VERSION}.gem", timeout: nil
315317

316-
FileUtils.rm_rf application.path("bin")
318+
bundle
317319

318-
if application.path("bin_original").exist?
319-
FileUtils.cp_r application.path("bin_original"), application.path("bin")
320-
end
320+
FileUtils.rm_rf application.path("bin")
321321

322-
application.run! "#{application.spring} binstub --all"
323-
@installed = true
322+
if application.path("bin_original").exist?
323+
FileUtils.cp_r application.path("bin_original"), application.path("bin")
324324
end
325+
326+
application.run! "#{application.spring} binstub --all"
327+
@installed = true
325328
end
326329

327330
def copy_to(path)

0 commit comments

Comments
 (0)