From 2af19a1e54678beba6e107400fc2b34b7350354e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 4 Feb 2010 23:11:58 -0800 Subject: adding load_file method --- test/test_psych.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/test_psych.rb') diff --git a/test/test_psych.rb b/test/test_psych.rb index 4bea1b3..c01d539 100644 --- a/test/test_psych.rb +++ b/test/test_psych.rb @@ -1,5 +1,6 @@ require 'minitest/autorun' require 'psych' +require 'tempfile' class TestPsych < MiniTest::Unit::TestCase def test_simple @@ -34,4 +35,11 @@ class TestPsych < MiniTest::Unit::TestCase Psych.load("--- !foo.bar,2002/foo\nhello: world") assert_equal({ 'hello' => 'world' }, got) end + + def test_load_file + name = File.join(Dir.tmpdir, 'yikes.yml') + File.open(name, 'wb') { |f| f.write('--- hello world') } + + assert_equal 'hello world', Psych.load_file(name) + end end -- cgit v1.2.3