From 007c4da9ae3d5ad03a9eefd4dfccf9ca447715f1 Mon Sep 17 00:00:00 2001 From: Paul Hieromnimon Date: Tue, 10 Aug 2010 19:09:24 -0700 Subject: Raising exception if fixture file can't be found --- activerecord/test/cases/fixtures_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'activerecord/test/cases/fixtures_test.rb') diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index 93f8749255..a8c1c04f8b 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -153,6 +153,17 @@ class FixturesTest < ActiveRecord::TestCase assert_not_nil Fixtures.new( Account.connection, "companies", 'Company', FIXTURES_ROOT + "/naked/yml/companies") end + def test_nonexistent_fixture_file + nonexistent_fixture_path = FIXTURES_ROOT + "/imnothere" + + #sanity check to make sure that this file never exists + assert Dir[nonexistent_fixture_path+"*"].empty? + + assert_raise(FixturesFileNotFound) do + Fixtures.new( Account.connection, "companies", 'Company', nonexistent_fixture_path) + end + end + def test_dirty_dirty_yaml_file assert_raise(Fixture::FormatError) do Fixtures.new( Account.connection, "courses", 'Course', FIXTURES_ROOT + "/naked/yml/courses") -- cgit v1.2.3