Skip to content

Commit

Permalink
Use the project's tmp dir for specs
Browse files Browse the repository at this point in the history
  • Loading branch information
bew committed Nov 28, 2017
1 parent bca3f61 commit 67abaa5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/compiler/crystal/tools/init_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ require "ini"
require "spec"
require "yaml"

BIN_CRYSTAL = File.expand_path("#{__DIR__}/../../../../bin/crystal")
PROJECT_ROOT_DIR = "#{__DIR__}/../../../.."
BIN_CRYSTAL = File.expand_path("#{PROJECT_ROOT_DIR}/bin/crystal")

private def exec_init(project_name, project_dir = nil, type = "lib")
args = ["init", type, project_name]
Expand All @@ -21,8 +22,8 @@ end
# Creates a temporary directory, cd to it and run the block inside it.
# The directory and its content is deleted when the block return.
private def within_temporary_directory
tmp_path = "#{__DIR__}/crystal_init_spec_tmp_dir-#{rand(10_000)}"
Dir.mkdir(tmp_path)
tmp_path = "#{PROJECT_ROOT_DIR}/tmp/init_spec_tmp_dir-#{Process.pid}"
Dir.mkdir_p(tmp_path)
begin
Dir.cd(tmp_path) do
yield
Expand Down

0 comments on commit 67abaa5

Please sign in to comment.