From e6474080622220ed892c287ba2e62a5c29087741 Mon Sep 17 00:00:00 2001 From: interdictor Date: Thu, 21 May 2020 22:45:22 +0200 Subject: [PATCH] Add test_default_value_attribute to about_hashes.rb --- src/about_hashes.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/about_hashes.rb b/src/about_hashes.rb index ef58621..327bfc2 100644 --- a/src/about_hashes.rb +++ b/src/about_hashes.rb @@ -113,4 +113,14 @@ class AboutHashes < Neo::Koan assert_equal __(["dos"]), hash[:two] assert_equal __([]), hash[:three] end + + def test_default_value_attribute + hash = Hash.new + + assert_equal __(nil), hash[:some_key] + + hash.default = 'peanut' + + assert_equal __('peanut'), hash[:some_key] + end end