diff --git a/lib/cancan/ability.rb b/lib/cancan/ability.rb index 2a3dc808..3b4f7f0b 100644 --- a/lib/cancan/ability.rb +++ b/lib/cancan/ability.rb @@ -214,7 +214,7 @@ def unauthorized_message(action, subject) keys = unauthorized_message_keys(action, subject) variables = {:action => action.to_s} variables[:subject] = (subject.class == Class ? subject : subject.class).to_s.underscore.humanize.downcase - message = I18n.translate(nil, variables.merge(:scope => :unauthorized, :default => keys + [""])) + message = I18n.translate(nil, **variables.merge(:scope => :unauthorized, :default => keys + [""])) message.blank? ? nil : message end diff --git a/lib/cancan/matchers.rb b/lib/cancan/matchers.rb index 4a4fb947..c246bc51 100644 --- a/lib/cancan/matchers.rb +++ b/lib/cancan/matchers.rb @@ -4,11 +4,11 @@ ability.can?(*args) end - failure_message_for_should do |ability| + failure_message do |ability| "expected to be able to #{args.map(&:inspect).join(" ")}" end - failure_message_for_should_not do |ability| + failure_message_when_negated do |ability| "expected not to be able to #{args.map(&:inspect).join(" ")}" end end diff --git a/spec/matchers.rb b/spec/matchers.rb index b98bd24f..1827b153 100644 --- a/spec/matchers.rb +++ b/spec/matchers.rb @@ -3,11 +3,11 @@ original_string.split('').sort == given_string.split('').sort end - failure_message_for_should do |given_string| + failure_message do |given_string| "expected \"#{given_string}\" to have the same characters as \"#{original_string}\"" end - failure_message_for_should_not do |given_string| + failure_message_when_negated do |given_string| "expected \"#{given_string}\" not to have the same characters as \"#{original_string}\"" end end