diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-23 14:02:33 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-23 15:06:13 -0700 |
commit | 5ec23b95ba7d5a00d20f6ec59f75c34a2ac73b5d (patch) | |
tree | 4ecceb39d9bb87dc61e9b40035aef1264c879616 | |
parent | 1716da07204193c8acf967e2d75a53a82e4c7c28 (diff) | |
download | rails-5ec23b95ba7d5a00d20f6ec59f75c34a2ac73b5d.tar.gz rails-5ec23b95ba7d5a00d20f6ec59f75c34a2ac73b5d.tar.bz2 rails-5ec23b95ba7d5a00d20f6ec59f75c34a2ac73b5d.zip |
fixing 1.8 support for new fixture tests
-rw-r--r-- | activerecord/lib/active_record/fixtures/file.rb | 5 | ||||
-rw-r--r-- | activerecord/test/cases/fixtures/file_test.rb | 6 | ||||
-rw-r--r-- | activerecord/test/fixtures/categories_ordered.yml | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/fixtures/file.rb b/activerecord/lib/active_record/fixtures/file.rb index da07cf5da1..04f494db2c 100644 --- a/activerecord/lib/active_record/fixtures/file.rb +++ b/activerecord/lib/active_record/fixtures/file.rb @@ -43,7 +43,10 @@ module ActiveRecord # Validate our unmarshalled data. def validate(data) - raise Fixture::FormatError, 'fixture is not a hash' unless Hash === data + unless Hash === data || YAML::Omap === data + raise Fixture::FormatError, 'fixture is not a hash' + end + raise Fixture::FormatError unless data.all? { |name, row| Hash === row } data end diff --git a/activerecord/test/cases/fixtures/file_test.rb b/activerecord/test/cases/fixtures/file_test.rb index 174f41f412..8dbf92ae9a 100644 --- a/activerecord/test/cases/fixtures/file_test.rb +++ b/activerecord/test/cases/fixtures/file_test.rb @@ -25,13 +25,15 @@ module ActiveRecord "rails_core_account", "last_account", "rails_core_account_2", - "odegy_account"], fh.to_a.map(&:first) + "odegy_account"].sort, fh.to_a.map(&:first).sort end end def test_values File.open(::File.join(FIXTURES_ROOT, "accounts.yml")) do |fh| - assert_equal [1,2,3,4,5,6], fh.to_a.map(&:last).map { |x| x['id'] } + assert_equal [1,2,3,4,5,6].sort, fh.to_a.map(&:last).map { |x| + x['id'] + }.sort end end diff --git a/activerecord/test/fixtures/categories_ordered.yml b/activerecord/test/fixtures/categories_ordered.yml index 2afc6cb5a9..294a6368d6 100644 --- a/activerecord/test/fixtures/categories_ordered.yml +++ b/activerecord/test/fixtures/categories_ordered.yml @@ -1,4 +1,4 @@ ---- !!omap +--- !omap <% 100.times do |i| %> - fixture_no_<%= i %>: id: <%= i %> |