From 08604ae8fd81c793bc7b002e69b45ea01d512354 Mon Sep 17 00:00:00 2001 From: Arun Kumar Mohan Date: Tue, 15 Sep 2020 21:09:04 -0500 Subject: [PATCH] Remove Hash#diff usage from cancan helper --- spec/support/cancan_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/support/cancan_helper.rb b/spec/support/cancan_helper.rb index fb9b122664..efdfefe604 100644 --- a/spec/support/cancan_helper.rb +++ b/spec/support/cancan_helper.rb @@ -13,7 +13,8 @@ module Spree ability_hash.each do |action, _true_or_false| @ability_result[action] = ability.can?(action, target) end - ability_hash.diff(@ability_result).none? + + expect(ability_hash).to eq(@ability_result) end failure_message do |user| @@ -21,7 +22,7 @@ module Spree ability_hash = { ability_hash => true } if ability_hash.is_a? Symbol # e.g.: :create ability_hash = ability_hash.inject({}){ |member, i| member.merge(i => true) } if ability_hash.is_a? Array # e.g.: [:create, :read] => {:create=>true, :read=>true} target = options[:for] - message = "expected User:#{user} to have ability:#{ability_hash} for #{target}, but actual result is #{@ability_result}" + message = "expected User:#{user} to have ability: #{ability_hash} for #{target}, but actual result is #{@ability_result}" end # to clean up output of RSpec Documentation format