diff options
author | Marcus Stollsteimer <sto.mar@web.de> | 2017-12-19 23:02:11 +0100 |
---|---|---|
committer | Marcus Stollsteimer <sto.mar@web.de> | 2017-12-19 23:02:11 +0100 |
commit | 1f2eb4b7b968f0f1f7083f167d3e35a1fe254cdc (patch) | |
tree | 1940ae79572a9bfa1a956bafbf71e10607b30839 /test | |
parent | dd8bb41f60c64b4128ca0a2c91a38ae86adccc0e (diff) | |
download | psych-1f2eb4b7b968f0f1f7083f167d3e35a1fe254cdc.zip |
Add more test cases for fallback of Psych.load_file
Add more test cases for the fallback keyword argument of
Psych.load_file; additionally, fix an error in the docs.
Diffstat (limited to 'test')
-rw-r--r-- | test/psych/test_psych.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb index 2812fd1..2d4a7cc 100644 --- a/test/psych/test_psych.rb +++ b/test/psych/test_psych.rb @@ -144,8 +144,20 @@ class TestPsych < Psych::TestCase } end + def test_load_file_default_return_value + Tempfile.create(['empty', 'yml']) {|t| + assert_equal false, Psych.load_file(t.path) + } + end + def test_load_file_with_fallback Tempfile.create(['empty', 'yml']) {|t| + assert_equal 42, Psych.load_file(t.path, fallback: 42) + } + 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) } end |