vagrant/test/unit/support/shared/plugin_command_context.rb

16 lines
365 B
Ruby
Raw Normal View History

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
shared_context "command plugin helpers" do
2014-01-14 00:42:40 -05:00
def command_lambda(name, result, **opts)
lambda do
Class.new(Vagrant.plugin("2", "command")) do
define_method(:execute) do
2014-01-14 00:42:40 -05:00
raise opts[:exception] if opts[:exception]
result
end
end
end
end
end