lib/foodtaster/rspec/example_methods.rb in foodtaster-0.0.1 vs lib/foodtaster/rspec/example_methods.rb in foodtaster-0.0.3
- old
+ new
@@ -5,12 +5,22 @@
Foodtaster::RSpecRun.current.get_vm(vm_name)
end
def run_chef_on(vm_name, &block)
chef_config = ChefConfig.new.tap{ |conf| block.call(conf) }.to_hash
+ @previous_chef_config = chef_config
+
vm = get_vm(vm_name)
vm.run_chef(chef_config)
end
+
+ 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
+
+ alias :repeat_chef_run :rerun_chef_on
private
class ChefConfig
attr_accessor :json, :run_list