Skip to content

Commit 987dce0

Browse files
committed
Merge pull request ryanb#421 from amc-projects/master
Compatibility fix for rspec-instafail and rspec1
2 parents e0492f5 + 3b33b36 commit 987dce0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/cancan/matchers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
RSpec = Spec unless defined? RSpec # for RSpec 1 compatability
2-
RSpec::Matchers.define :be_able_to do |*args|
1+
rspec_module = defined?(RSpec::Core) ? 'RSpec' : 'Spec' # for RSpec 1 compatability
2+
Kernel.const_get(rspec_module)::Matchers.define :be_able_to do |*args|
33
match do |ability|
44
ability.can?(*args)
55
end

0 commit comments

Comments
 (0)