aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/CHANGELOG6
-rwxr-xr-xactiverecord/lib/active_record/fixtures.rb37
-rw-r--r--activerecord/test/fixtures/bad_fixtures/attr_with_numeric_first_char1
-rw-r--r--activerecord/test/fixtures/bad_fixtures/attr_with_spaces1
-rw-r--r--activerecord/test/fixtures/bad_fixtures/blank_line3
-rw-r--r--activerecord/test/fixtures/bad_fixtures/duplicate_attributes3
-rw-r--r--activerecord/test/fixtures/bad_fixtures/missing_value1
-rw-r--r--activerecord/test/fixtures/developers_projects/david_action_controller3
-rw-r--r--activerecord/test/fixtures/developers_projects/david_active_record3
-rw-r--r--activerecord/test/fixtures/developers_projects/jamis_active_record2
-rw-r--r--activerecord/test/fixtures/subscribers.yml7
-rw-r--r--activerecord/test/fixtures/subscribers/first2
-rw-r--r--activerecord/test/fixtures/subscribers/second2
-rwxr-xr-xactiverecord/test/fixtures_test.rb16
14 files changed, 12 insertions, 75 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 0909be67df..773e4ce90e 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixtures: removed support for the ancient pre-YAML file format. #10736 [John Barnette]
+
* More thoroughly quote table names. #10698 [dimdenis, lotswholetime, Jeremy Kemper]
* update_all ignores scoped :order and :limit, so post.comments.update_all doesn't try to include the comment order in the update statement. #10686 [Brendan Ribera]
@@ -80,7 +82,7 @@ so newlines etc are escaped #10385 [Norbert Crombach]
* Dynamic finders on association collections respect association :order and :limit. #10211, #10227 [Patrick Joyce, Rick Olson, Jack Danger Canty]
-* Add 'foxy' support for fixtures of polymorphic associations. #10183 [jbarnette, David Lowenfels]
+* Add 'foxy' support for fixtures of polymorphic associations. #10183 [John Barnette, David Lowenfels]
* validates_inclusion_of and validates_exclusion_of allow formatted :message strings. #8132 [devrieda, Mike Naberezny]
@@ -128,7 +130,7 @@ so newlines etc are escaped #10385 [Norbert Crombach]
- autofill timestamp columns
- support YAML defaults
- fixture label interpolation
- Enabled for fixtures that correspond to a model class and don't specify a primary key value. #9981 [jbarnette]
+ Enabled for fixtures that correspond to a model class and don't specify a primary key value. #9981 [John Barnette]
* Add docs explaining how to protect all attributes using attr_accessible with no arguments. Closes #9631 [boone, rmm5t]
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:
diff --git a/activerecord/test/fixtures/bad_fixtures/attr_with_numeric_first_char b/activerecord/test/fixtures/bad_fixtures/attr_with_numeric_first_char
deleted file mode 100644
index ef27947f27..0000000000
--- a/activerecord/test/fixtures/bad_fixtures/attr_with_numeric_first_char
+++ /dev/null
@@ -1 +0,0 @@
-1b => 1
diff --git a/activerecord/test/fixtures/bad_fixtures/attr_with_spaces b/activerecord/test/fixtures/bad_fixtures/attr_with_spaces
deleted file mode 100644
index 46fd6f2fe9..0000000000
--- a/activerecord/test/fixtures/bad_fixtures/attr_with_spaces
+++ /dev/null
@@ -1 +0,0 @@
-a b => 1
diff --git a/activerecord/test/fixtures/bad_fixtures/blank_line b/activerecord/test/fixtures/bad_fixtures/blank_line
deleted file mode 100644
index 3ea1f71743..0000000000
--- a/activerecord/test/fixtures/bad_fixtures/blank_line
+++ /dev/null
@@ -1,3 +0,0 @@
-a => 1
-
-b => 2
diff --git a/activerecord/test/fixtures/bad_fixtures/duplicate_attributes b/activerecord/test/fixtures/bad_fixtures/duplicate_attributes
deleted file mode 100644
index cc0236f26f..0000000000
--- a/activerecord/test/fixtures/bad_fixtures/duplicate_attributes
+++ /dev/null
@@ -1,3 +0,0 @@
-a => 1
-b => 2
-a => 3
diff --git a/activerecord/test/fixtures/bad_fixtures/missing_value b/activerecord/test/fixtures/bad_fixtures/missing_value
deleted file mode 100644
index fb59ec33e8..0000000000
--- a/activerecord/test/fixtures/bad_fixtures/missing_value
+++ /dev/null
@@ -1 +0,0 @@
-a =>
diff --git a/activerecord/test/fixtures/developers_projects/david_action_controller b/activerecord/test/fixtures/developers_projects/david_action_controller
deleted file mode 100644
index e6e9d0e59b..0000000000
--- a/activerecord/test/fixtures/developers_projects/david_action_controller
+++ /dev/null
@@ -1,3 +0,0 @@
-developer_id => 1
-project_id => 2
-joined_on => 2004-10-10 \ No newline at end of file
diff --git a/activerecord/test/fixtures/developers_projects/david_active_record b/activerecord/test/fixtures/developers_projects/david_active_record
deleted file mode 100644
index 2ef474c10d..0000000000
--- a/activerecord/test/fixtures/developers_projects/david_active_record
+++ /dev/null
@@ -1,3 +0,0 @@
-developer_id => 1
-project_id => 1
-joined_on => 2004-10-10 \ No newline at end of file
diff --git a/activerecord/test/fixtures/developers_projects/jamis_active_record b/activerecord/test/fixtures/developers_projects/jamis_active_record
deleted file mode 100644
index 91beb80797..0000000000
--- a/activerecord/test/fixtures/developers_projects/jamis_active_record
+++ /dev/null
@@ -1,2 +0,0 @@
-developer_id => 2
-project_id => 1 \ No newline at end of file
diff --git a/activerecord/test/fixtures/subscribers.yml b/activerecord/test/fixtures/subscribers.yml
new file mode 100644
index 0000000000..9ffb4a156f
--- /dev/null
+++ b/activerecord/test/fixtures/subscribers.yml
@@ -0,0 +1,7 @@
+first:
+ nick: alterself
+ name: Luke Holden
+
+second:
+ nick: webster132
+ name: David Heinemeier Hansson
diff --git a/activerecord/test/fixtures/subscribers/first b/activerecord/test/fixtures/subscribers/first
deleted file mode 100644
index 5287e26e4d..0000000000
--- a/activerecord/test/fixtures/subscribers/first
+++ /dev/null
@@ -1,2 +0,0 @@
-nick => alterself
-name => Luke Holden
diff --git a/activerecord/test/fixtures/subscribers/second b/activerecord/test/fixtures/subscribers/second
deleted file mode 100644
index 2345e4475a..0000000000
--- a/activerecord/test/fixtures/subscribers/second
+++ /dev/null
@@ -1,2 +0,0 @@
-nick => webster132
-name => David Heinemeier Hansson
diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb
index bbc3e1e5a4..d836e456a2 100755
--- a/activerecord/test/fixtures_test.rb
+++ b/activerecord/test/fixtures_test.rb
@@ -113,22 +113,6 @@ class FixturesTest < ActiveSupport::TestCase
assert first
end
- def test_bad_format
- path = File.join(File.dirname(__FILE__), 'fixtures', 'bad_fixtures')
- Dir.entries(path).each do |file|
- next unless File.file?(file) and file !~ Fixtures::DEFAULT_FILTER_RE
- assert_raise(Fixture::FormatError) {
- Fixture.new(bad_fixtures_path, file)
- }
- end
- end
-
- def test_deprecated_yaml_extension
- assert_raise(Fixture::FormatError) {
- Fixtures.new(nil, 'bad_extension', 'BadExtension', File.join(File.dirname(__FILE__), 'fixtures'))
- }
- end
-
def test_logger_level_invariant
level = ActiveRecord::Base.logger.level
create_fixtures('topics')