module Foodtaster::RSpec::ExampleMethods

Public Instance Methods

get_vm(vm_name) click to toggle source
# File lib/foodtaster/rspec/example_methods.rb, line 4
def get_vm(vm_name)
  Foodtaster::Vm.get(vm_name).tap do |vm|
    vm.prepare unless vm.prepared?
  end
end
repeat_chef_run(vm_name)
Alias for: rerun_chef_on
rerun_chef_on(vm_name) click to toggle source
# File lib/foodtaster/rspec/example_methods.rb, line 21
def rerun_chef_on(vm_name)
  raise RuntimeError, "No previous Chef run was made" unless @previous_chef_config
  vm = get_vm(vm_name)
  vm.run_chef(@previous_chef_config)
end
Also aliased as: repeat_chef_run
run_chef_on(vm_name, &block) click to toggle source
# File lib/foodtaster/rspec/example_methods.rb, line 10
def run_chef_on(vm_name, &block)
  chef_config = ChefConfig.new
  instance_exec chef_config, &block
  chef_config_as_hash = chef_config.to_hash

  @previous_chef_config = chef_config_as_hash

  vm = get_vm(vm_name)
  vm.run_chef(chef_config_as_hash)
end