Method: Vagrant::TestHelpers#action_env
- Defined in:
- lib/vagrant/test_helpers.rb
#action_env(v_env = nil) ⇒ Object
Returns a blank app (callable) and action environment with the given vagrant environment. This allows for testing of middlewares.
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/vagrant/test_helpers.rb', line 79 def action_env(v_env = nil) v_env ||= vagrant_env # duplicate the Vagrant::Environment ui and get the default vm object # for the new action environment from the first pair in the vms list opts = {:ui => v_env.ui.dup, :vm => v_env.vms.first.last} app = lambda { |env| } env = Vagrant::Action::Environment.new(opts) env["vagrant.test"] = true [app, env] end |