Sha256: 42e3111a82f6c5e6b630d6949c6390510d9b8949559dfc941f6ffe6d8f978d02
Contents?: true
Size: 483 Bytes
Versions: 7
Compression:
Stored size: 483 Bytes
Contents
require "test_helper" class ExperimentalKeyErrorNameCorrectionTest < Minitest::Test def test_corrects_hash_key_name hash = { "foo" => 1, bar: 2 } error = assert_raises(KeyError) { hash.fetch(:bax) } assert_correction ":bar", error.corrections assert_match "Did you mean? :bar", error.to_s error = assert_raises(KeyError) { hash.fetch("fooo") } assert_correction %("foo"), error.corrections assert_match %(Did you mean? "foo"), error.to_s end end
Version data entries
7 entries across 7 versions & 2 rubygems