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

22 lines
397 B
Ruby
Raw Normal View History

shared_context "capability_helpers" do
def detect_class(result)
Class.new do
2014-01-08 00:29:05 +00:00
define_method(:detect?) do |*args|
result
end
end
end
def cap_instance(name, options=nil)
options ||= {}
Class.new do
if !options[:corrupt]
define_method(name) do |*args|
raise "cap: #{name} #{args.inspect}"
end
end
end.new
end
end