提交 4700d027 编写于 作者: K Kassio Borges

load fixtures from linked folders

上级 77a00303
...@@ -637,7 +637,7 @@ def column_names ...@@ -637,7 +637,7 @@ def column_names
end end
def read_fixture_files def read_fixture_files
yaml_files = Dir["#{@path}/**/*.yml"].select { |f| yaml_files = Dir["#{@path}/{**,*}/*.yml"].select { |f|
::File.file?(f) ::File.file?(f)
} + [yaml_file_path] } + [yaml_file_path]
...@@ -756,7 +756,7 @@ def set_fixture_class(class_names = {}) ...@@ -756,7 +756,7 @@ def set_fixture_class(class_names = {})
def fixtures(*fixture_set_names) def fixtures(*fixture_set_names)
if fixture_set_names.first == :all 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] } fixture_set_names.map! { |f| f[(fixture_path.to_s.size + 1)..-5] }
else else
fixture_set_names = fixture_set_names.flatten.map { |n| n.to_s } fixture_set_names = fixture_set_names.flatten.map { |n| n.to_s }
......
...@@ -584,7 +584,7 @@ class LoadAllFixturesTest < ActiveRecord::TestCase ...@@ -584,7 +584,7 @@ class LoadAllFixturesTest < ActiveRecord::TestCase
fixtures :all fixtures :all
def test_all_there 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
end end
...@@ -593,7 +593,7 @@ class LoadAllFixturesWithPathnameTest < ActiveRecord::TestCase ...@@ -593,7 +593,7 @@ class LoadAllFixturesWithPathnameTest < ActiveRecord::TestCase
fixtures :all fixtures :all
def test_all_there 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
end end
......
../to_be_linked/
\ No newline at end of file
david:
name: David
account: signals37
jamis:
name: Jamis
account: signals37
settings:
:symbol: symbol
string: string
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册