Class: ChefSpec::Batali
- Inherits:
-
Object
- Object
- ChefSpec::Batali
- Extended by:
- Forwardable
- Includes:
- Singleton
- Defined in:
- lib/batali/chefspec.rb
Overview
Batali integration class
Instance Method Summary collapse
-
#initialize ⇒ Batali
constructor
Create new instance.
-
#setup! ⇒ Object
Setup the environment (load cookbooks).
-
#teardown! ⇒ Object
Clean up after complete.
Constructor Details
#initialize ⇒ Batali
Create new instance
19 20 21 |
# File 'lib/batali/chefspec.rb', line 19 def initialize @vendor_path = Dir.mktmpdir end |
Instance Method Details
#setup! ⇒ Object
Setup the environment (load cookbooks)
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/batali/chefspec.rb', line 24 def setup! output = '' begin ::Batali::Command::Update.new( Smash.new( :file => File.join(Dir.pwd, 'Batali'), :path => @vendor_path, :update => { :install => true }, :ui => Bogo::Ui.new( :app_name => 'Batali', :output_to => StringIO.new(output) ) ), [] ).execute! RSpec.configure do |config| config.cookbook_path = @vendor_path end rescue => e $stderr.puts "Batali failure - #{e.class}: #{e.}" $stderr.puts output raise end end |
#teardown! ⇒ Object
Clean up after complete
52 53 54 55 56 |
# File 'lib/batali/chefspec.rb', line 52 def teardown! if(File.directory?(@vendor_path)) FileUtils.rm_rf(@vendor_path) end end |