Skip to content

Instantly share code, notes, and snippets.

View DataDaoDe's full-sized avatar

John Faucett DataDaoDe

View GitHub Profile
@DataDaoDe
DataDaoDe / equal_with_indifferent_access.rb
Last active February 10, 2023 14:30 — forked from sue445/equal_with_indifferent_access.rb
[RSpec custom matcher] match hashes with indifferent access
# match hashes with indifferent access
#
# example)
# expect({"key1" => 1, :key2 => 2}).to equal_with_indifferent_access(key1: 1, key2: 2)
RSpec::Matchers.define :eq_with_indifferent_access do |expected|
match do |actual|
actual.with_indifferent_access == expected.with_indifferent_access
end