Permalink
Browse files

Errno::ENOENT error makes more sense when a file cannot be found

  • Loading branch information...
1 parent 4beaa9b commit d09b67cfc0df87e39b257409fad72f7bb6d72a41 @tenderlove tenderlove committed Dec 10, 2011
Showing with 1 addition and 11 deletions.
  1. +0 −10 activerecord/lib/active_record/fixtures.rb
  2. +1 −1 activerecord/test/cases/fixtures_test.rb
@@ -22,8 +22,6 @@ class FixtureClassNotFound < StandardError #:nodoc:
end
end
-class FixturesFileNotFound < StandardError; end
-
module ActiveRecord
# \Fixtures are a way of organizing data that you want to test against; in short, sample data.
#
@@ -644,14 +642,6 @@ def column_names
end
def read_fixture_files
- if ::File.file?(yaml_file_path)
- read_yaml_fixture_files
- else
- raise FixturesFileNotFound, "Could not find #{yaml_file_path}"
- end
- end
-
- def read_yaml_fixture_files
yaml_files = Dir["#{@fixture_path}/**/*.yml"].select { |f|
::File.file?(f)
} + [yaml_file_path]
@@ -179,7 +179,7 @@ def test_nonexistent_fixture_file
#sanity check to make sure that this file never exists
assert Dir[nonexistent_fixture_path+"*"].empty?
- assert_raise(FixturesFileNotFound) do
+ assert_raise(Errno::ENOENT) do
ActiveRecord::Fixtures.new( Account.connection, "companies", 'Company', nonexistent_fixture_path)
end
end

0 comments on commit d09b67c

Please sign in to comment.