Permalink
Browse files

Compatibility fix for using cancan with rspec-instafail and rspec1

  • Loading branch information...
1 parent 600a3e1 commit 3b33b36de9142ab95a01130e5234dc4eeff19196 @schlick schlick committed Jul 19, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/cancan/matchers.rb
View
4 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

0 comments on commit 3b33b36

Please sign in to comment.