aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/fixtures/file_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/fixtures/file_test.rb b/activerecord/test/cases/fixtures/file_test.rb
index af7a2e5a4e..38494a7857 100644
--- a/activerecord/test/cases/fixtures/file_test.rb
+++ b/activerecord/test/cases/fixtures/file_test.rb
@@ -41,6 +41,23 @@ module ActiveRecord
assert_equal [], devs - fh.to_a.map(&:first)
end
end
+
+ def test_empty_file
+ tmp_yaml ['empty', 'yml'], '' do |t|
+ assert_equal [], File.open(t.path) { |fh| fh.to_a }
+ end
+ end
+
+ private
+ def tmp_yaml(name, contents)
+ t = Tempfile.new name
+ t.binmode
+ t.write contents
+ t.close
+ yield t
+ ensure
+ t.close true
+ end
end
end
end