Move Vagrant::Machine monkey patch out to a spec support file

This commit is contained in:
Fabio Rehm 2013-04-21 18:27:32 -03:00
parent 3909a26ea3
commit 8c8c11f07c
2 changed files with 13 additions and 14 deletions

View file

@ -1,19 +1,5 @@
require 'acceptance_helper' require 'acceptance_helper'
# Monkey patch vagrant in order to reuse the UI test object that is set on
# our Vagrant::Environments
#
# TODO: Find out if this makes sense to be on vagrant core itself
require 'vagrant/machine'
Vagrant::Machine.class_eval do
alias :old_action :action
define_method :action do |name, extra_env = nil|
extra_env = { ui: @env.ui }.merge(extra_env || {})
old_action name, extra_env
end
end
describe 'Sanity check' do describe 'Sanity check' do
after(:all) { destroy_container } after(:all) { destroy_container }

View file

@ -0,0 +1,13 @@
# Monkey patch vagrant in order to reuse the UI test object that is set on
# our Vagrant::Environments
#
# TODO: Find out if this makes sense to be on vagrant core itself
require 'vagrant/machine'
Vagrant::Machine.class_eval do
alias :old_action :action
define_method :action do |name, extra_env = nil|
extra_env = { ui: @env.ui }.merge(extra_env || {})
old_action name, extra_env
end
end