diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-08 03:54:40 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-08 03:54:40 +0000 |
commit | 8f7fa55e8da2463136f2e28c0a5680783ae85fbc (patch) | |
tree | c59dd56f523dff25bea753a110c28c722f6dcd11 /activerecord/lib/active_record | |
parent | ce84cebc0e8127e4c5d82c314ee446d802003cfb (diff) | |
download | rails-8f7fa55e8da2463136f2e28c0a5680783ae85fbc.tar.gz rails-8f7fa55e8da2463136f2e28c0a5680783ae85fbc.tar.bz2 rails-8f7fa55e8da2463136f2e28c0a5680783ae85fbc.zip |
Fixtures: removed support for the ancient pre-YAML file format. Closes #10736.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8594 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/fixtures.rb | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 7ee17ac8b0..c5b90efb4b 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -687,14 +687,6 @@ class Fixtures < (RUBY_VERSION < '1.9' ? YAML::Omap : Hash) read_yaml_fixture_files elsif File.file?(csv_file_path) read_csv_fixture_files - else - # Standard fixtures - Dir.entries(@fixture_path).each do |file| - path = File.join(@fixture_path, file) - if File.file?(path) and file !~ @file_filter - self[file] = Fixture.new(path, model_class) - end - end end end @@ -773,15 +765,7 @@ class Fixture #:nodoc: attr_reader :model_class def initialize(fixture, model_class) - case fixture - when Hash, YAML::Omap - @fixture = fixture - when String - @fixture = read_fixture_file(fixture) - else - raise ArgumentError, "Bad fixture argument #{fixture.inspect} during creation of #{class_name} fixture" - end - + @fixture = fixture @model_class = model_class.is_a?(Class) ? model_class : model_class.constantize rescue nil end @@ -821,25 +805,6 @@ class Fixture #:nodoc: raise FixtureClassNotFound, "No class attached to find." end end - - private - def read_fixture_file(fixture_file_path) - IO.readlines(fixture_file_path).inject({}) do |fixture, line| - # Mercifully skip empty lines. - next if line =~ /^\s*$/ - - # Use the same regular expression for attributes as Active Record. - unless md = /^\s*([a-zA-Z][-_\w]*)\s*=>\s*(.+)\s*$/.match(line) - raise FormatError, "#{fixture_file_path}: fixture format error at '#{line}'. Expecting 'key => value'." - end - key, value = md.captures - - # Disallow duplicate keys to catch typos. - raise FormatError, "#{fixture_file_path}: duplicate '#{key}' in fixture." if fixture[key] - fixture[key] = value.strip - fixture - end - end end module Test #:nodoc: |