Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Compatibility fix for rspec-instafail and rspec1 #421

Merged
merged 1 commit into from

2 participants

@schlick

Please see issue: #420

Summary: the existing compatibility fix for rspec1 breaks when using rspec-instafail. It defines RSpec module which cancan is using to determine rspec version used.

@ryanb ryanb merged commit 987dce0 into ryanb:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.