Sha256: 35d637273302202a91bd68ca56ee927a47b583c289845cb0010078cc38065178
Contents?: true
Size: 896 Bytes
Versions: 5
Compression:
Stored size: 896 Bytes
Contents
# These matchers are taken directly from CanCanCan: # https://github.com/CanCanCommunity/cancancan/blob/develop/lib/cancan/matchers.rb rspec_module = defined?(RSpec::Core) ? 'RSpec' : 'Spec' # for RSpec 1 compatability if rspec_module == 'RSpec' require 'rspec/core' require 'rspec/expectations' end Kernel.const_get(rspec_module)::Matchers.define :be_able_to do |*args| match do |ability| ability.can?(*args) end # Check that RSpec is < 2.99 if !respond_to?(:failure_message) && respond_to?(:failure_message_for_should) alias :failure_message :failure_message_for_should alias :failure_message_when_negated :failure_message_for_should_not end failure_message do |ability| "expected to be able to #{args.map(&:inspect).join(" ")}" end failure_message_when_negated do |ability| "expected not to be able to #{args.map(&:inspect).join(" ")}" end end
Version data entries
5 entries across 5 versions & 1 rubygems