require 'test_helper' require 'review/yamlloader' require 'review/extentions' require 'tmpdir' class YAMLLoaderTest < Test::Unit::TestCase def setup @loader = ReVIEW::YAMLLoader.new end def teardown end def test_load_file Dir.mktmpdir do |dir| yaml_file = File.join(dir, 'test.yml') File.write(yaml_file, < { 'bar' => 'test' } end end def test_load_file_inherit Dir.mktmpdir do |dir| yaml_file = File.join(dir, 'test.yml') yaml_file2 = File.join(dir, 'test2.yml') File.write(yaml_file, < 2, 'k1' => { 'name' => 'test', 'name2' => 'value2', 'array' => [{ 'name' => 'N', 'val' => 'V' }] }, 'k2' => '3' }, yaml) end end def test_load_file_inherit2 Dir.mktmpdir do |dir| yaml_file = File.join(dir, 'test.yml') yaml_file2 = File.join(dir, 'test2.yml') yaml_file3 = File.join(dir, 'test3.yml') File.write(yaml_file, < 2, 'k1' => { 'name1' => 'value1-1', 'name2' => 'value2-2', 'name3' => 'value3-3' }, 'k2' => 'B', 'k3' => 'C' }, yaml) end end def test_load_file_inherit3 Dir.mktmpdir do |dir| yaml_file1 = File.join(dir, 'test1.yml') yaml_file2 = File.join(dir, 'test2.yml') yaml_file3 = File.join(dir, 'test3.yml') yaml_file4 = File.join(dir, 'test4.yml') yaml_file5 = File.join(dir, 'test5.yml') yaml_file6 = File.join(dir, 'test6.yml') yaml_file7 = File.join(dir, 'test7.yml') File.write(yaml_file7, < { 'name1' => 'N7', 'name2' => 'N6', 'name3' => 'N5', 'name4' => 'N4', 'name5' => 'N3', 'name6' => 'N2', 'name7' => 'N1' } }, yaml) end end def test_empty_file Dir.mktmpdir do |dir| yaml_file = File.join(dir, 'test.yml') File.write(yaml_file, <