features/steps/cli.rb in newgem-1.1.0 vs features/steps/cli.rb in newgem-1.2.0

- old
+ new

@@ -1,21 +1,25 @@ +def in_tmp_folder(&block) + FileUtils.chdir(@tmp_root, &block) +end + Given %r{^an existing newgem scaffold \[called '(.*)'\]} do |project_name| Given "a safe folder" newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem") setup_active_project_folder project_name - FileUtils.chdir @tmp_root do + in_tmp_folder do @stdout = "newgem.out" system "ruby #{newgem} #{project_name} > #{@stdout} 2> #{@stdout}" force_local_lib_override end end Given %r{^an existing newgem scaffold using options '(.*)' \[called '(.*)'\]} do |arguments, project_name| Given "a safe folder" newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem") setup_active_project_folder project_name - FileUtils.chdir @tmp_root do + in_tmp_folder do @stdout = "newgem.out" system "ruby #{newgem} #{arguments} #{project_name} > #{@stdout} 2> #{@stdout}" force_local_lib_override end end @@ -46,29 +50,29 @@ end When %r{^newgem is executed for project '(.*)' with no options$} do |project_name| @newgem_cmd = newgem_cmd setup_active_project_folder project_name - FileUtils.chdir @tmp_root do + in_tmp_folder do @stdout = "newgem.out" system "ruby #{@newgem_cmd} #{project_name} > #{@stdout}" force_local_lib_override end end When %r{^newgem is executed for project '(.*)' with options '(.*)'$} do |project_name, arguments| @newgem_cmd = newgem_cmd setup_active_project_folder project_name - FileUtils.chdir @tmp_root do + in_tmp_folder do @stdout = "newgem.out" system "ruby #{@newgem_cmd} #{arguments} #{project_name} > #{@stdout}" force_local_lib_override end end When /^newgem is executed only with options '(.*)'$/ do |arguments| @newgem_cmd = newgem_cmd - FileUtils.chdir @tmp_root do + in_tmp_folder do @stdout = "newgem.out" system "ruby #{@newgem_cmd} #{arguments} > #{@stdout}" end end