Skip to content

Commit 1975b03

Browse files
Chef unit test
Signed-off-by: Hanwen <[email protected]>
1 parent 32623e2 commit 1975b03

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cookbooks/aws-parallelcluster-shared/spec/spec_helper.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44
include Chef::Mixin::ShellOut
55

66
RSpec.configure do |c|
7+
c.before(:suite) do
8+
# Copy third-party cookbooks to cookbooks directory for ChefSpec tests
9+
require 'fileutils'
10+
third_party_path = File.expand_path('../../third-party', __dir__)
11+
cookbooks_path = File.expand_path('../..', __dir__)
12+
if Dir.exist?(third_party_path)
13+
Dir.glob(File.join(third_party_path, '*')).each do |cookbook|
14+
next unless File.directory?(cookbook)
15+
FileUtils.cp_r(cookbook, cookbooks_path)
16+
end
17+
end
18+
end
19+
720
c.before(:each) do
821
allow(File).to receive(:exist?).and_call_original
922
allow(Dir).to receive(:exist?).and_call_original

0 commit comments

Comments
 (0)