Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

tests don't write to spec/unit #29

Merged
merged 1 commit into from
Apr 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion spec/test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

require 'fileutils'
require 'tmpdir'

module TestHelpers

Expand Down Expand Up @@ -48,9 +49,11 @@ def reset_tempdir

def clear_tempdir
FileUtils.rm_rf(tempdir)
@tmpdir = nil
end

def tempdir
File.join(project_root, "spec/unit/specs-tmpdir" )
@tmpdir ||= Dir.mktmpdir("chef-dk")
File.realpath(@tmpdir)
end
end
6 changes: 5 additions & 1 deletion spec/unit/command/generator_commands_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def generator_context

before do
ChefDK::Generator.reset
reset_tempdir
end

context "when argv is empty" do
Expand All @@ -243,7 +244,6 @@ def generator_context
let(:argv) { [ new_file_name ] }

before do
reset_tempdir
FileUtils.cp_r(File.join(fixtures_path, "example_cookbook"), tempdir)
end

Expand Down Expand Up @@ -288,6 +288,10 @@ def generator_context
context "and path to the cookbook is given in the argv" do
let(:argv) { [cookbook_path, new_file_name ] }

before do
FileUtils.cp_r(File.join(fixtures_path, "example_cookbook"), tempdir)
end

it "configures the generator context" do
recipe_generator.read_and_validate_params
recipe_generator.setup_context
Expand Down