Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cancan/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/cancan/matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions spec/matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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