1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

load fixtures from linked folders

This commit is contained in:
Kassio Borges 2013-08-05 16:35:49 -03:00
parent 77a0030316
commit 4700d0279c
5 changed files with 17 additions and 4 deletions

View file

@ -637,7 +637,7 @@ module ActiveRecord
end
def read_fixture_files
yaml_files = Dir["#{@path}/**/*.yml"].select { |f|
yaml_files = Dir["#{@path}/{**,*}/*.yml"].select { |f|
::File.file?(f)
} + [yaml_file_path]
@ -756,7 +756,7 @@ module ActiveRecord
def fixtures(*fixture_set_names)
if fixture_set_names.first == :all
fixture_set_names = Dir["#{fixture_path}/**/*.{yml}"]
fixture_set_names = Dir["#{fixture_path}/{**,*}/*.{yml}"]
fixture_set_names.map! { |f| f[(fixture_path.to_s.size + 1)..-5] }
else
fixture_set_names = fixture_set_names.flatten.map { |n| n.to_s }

View file

@ -584,7 +584,7 @@ class LoadAllFixturesTest < ActiveRecord::TestCase
fixtures :all
def test_all_there
assert_equal %w(developers people tasks), fixture_table_names.sort
assert_equal %w(admin/accounts admin/users developers people tasks), fixture_table_names.sort
end
end
@ -593,7 +593,7 @@ class LoadAllFixturesWithPathnameTest < ActiveRecord::TestCase
fixtures :all
def test_all_there
assert_equal %w(developers people tasks), fixture_table_names.sort
assert_equal %w(admin/accounts admin/users developers people tasks), fixture_table_names.sort
end
end

1
activerecord/test/fixtures/all/admin vendored Symbolic link
View file

@ -0,0 +1 @@
../to_be_linked/

View file

@ -0,0 +1,2 @@
signals37:
name: 37signals

View file

@ -0,0 +1,10 @@
david:
name: David
account: signals37
jamis:
name: Jamis
account: signals37
settings:
:symbol: symbol
string: string