2014-01-08 00:26:58 +00:00
|
|
|
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|
|
2014-01-08 00:26:58 +00:00
|
|
|
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
|