From 3b33b36de9142ab95a01130e5234dc4eeff19196 Mon Sep 17 00:00:00 2001 From: Michael MacDonald Date: Tue, 19 Jul 2011 10:27:08 +1000 Subject: [PATCH] Compatibility fix for using cancan with rspec-instafail and rspec1 --- lib/cancan/matchers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cancan/matchers.rb b/lib/cancan/matchers.rb index 6c76c54..4a4fb94 100644 --- a/lib/cancan/matchers.rb +++ b/lib/cancan/matchers.rb @@ -1,5 +1,5 @@ -RSpec = Spec unless defined? RSpec # for RSpec 1 compatability -RSpec::Matchers.define :be_able_to do |*args| +rspec_module = defined?(RSpec::Core) ? 'RSpec' : 'Spec' # for RSpec 1 compatability +Kernel.const_get(rspec_module)::Matchers.define :be_able_to do |*args| match do |ability| ability.can?(*args) end