summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Stollsteimer <sto.mar@web.de>2018-04-24 18:12:24 +0200
committerMarcus Stollsteimer <sto.mar@web.de>2018-04-24 18:12:24 +0200
commite369254e8df8f8921d0827c5bfb953cc9b0cd7f0 (patch)
treed19b559e67c46b645893788fff2f5aa866a918d4
parent9dd18ddc1845952303c32a74b2778da3c943ec0b (diff)
downloadpsych-e369254e8df8f8921d0827c5bfb953cc9b0cd7f0.tar.gz
Add more test cases for fallback of Psych.load_file
Add test cases for the fallback keyword argument of Psych.load_file to make sure that a falsy fallback (nil or false) works properly.
-rw-r--r--test/psych/test_psych.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb
index bce6bf8..8f9a100 100644
--- a/test/psych/test_psych.rb
+++ b/test/psych/test_psych.rb
@@ -156,6 +156,13 @@ class TestPsych < Psych::TestCase
}
end
+ def test_load_file_with_fallback_nil_or_false
+ Tempfile.create(['empty', 'yml']) {|t|
+ assert_nil Psych.load_file(t.path, fallback: nil)
+ assert_equal false, Psych.load_file(t.path, fallback: false)
+ }
+ end
+
def test_load_file_with_fallback_hash
Tempfile.create(['empty', 'yml']) {|t|
assert_equal Hash.new, Psych.load_file(t.path, fallback: Hash.new)