diff --git a/lib/nesta/static/site.rb b/lib/nesta/static/site.rb index 406d672a..70acb6d1 100644 --- a/lib/nesta/static/site.rb +++ b/lib/nesta/static/site.rb @@ -61,8 +61,8 @@ def log(message) def set_app_root root = ::File.expand_path('.') - ['Gemfile', ].each do |expected| - if ! File.exist?(File.join(root, 'config', 'config.yml')) + ['Gemfile', File.join('config', 'config.yml')].each do |expected| + if ! File.exist?(File.join(root, expected)) message = "is this a Nesta site? (expected './#{expected}')" raise RuntimeError, message end diff --git a/test/support/temporary_files.rb b/test/support/temporary_files.rb index e20ecf51..c1af68a1 100644 --- a/test/support/temporary_files.rb +++ b/test/support/temporary_files.rb @@ -1,3 +1,5 @@ +require 'fileutils' + module TemporaryFiles TEMP_DIR = File.expand_path('tmp', File.join(File.dirname(__FILE__), '..')) @@ -21,7 +23,8 @@ def project_path(path) def in_temporary_project(*args, &block) FileUtils.mkdir_p(File.join(project_root, 'config')) - File.open(File.join(project_root, 'config', 'config.yml'), 'w').close + FileUtils.touch(File.join(project_root, 'Gemfile')) + FileUtils.touch(File.join(project_root, 'config', 'config.yml')) Dir.chdir(project_root) { yield project_root } ensure remove_temp_directory