mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Allows setting fixture_path to a Pathname
This commit is contained in:
parent
ecfdc842a5
commit
018fc5fc07
2 changed files with 10 additions and 1 deletions
|
@ -752,7 +752,7 @@ module ActiveRecord
|
||||||
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.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 }
|
||||||
end
|
end
|
||||||
|
|
|
@ -576,6 +576,15 @@ class LoadAllFixturesTest < ActiveRecord::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class LoadAllFixturesWithPathnameTest < ActiveRecord::TestCase
|
||||||
|
self.fixture_path = Pathname.new(FIXTURES_ROOT).join('all')
|
||||||
|
fixtures :all
|
||||||
|
|
||||||
|
def test_all_there
|
||||||
|
assert_equal %w(developers people tasks), fixture_table_names.sort
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class FasterFixturesTest < ActiveRecord::TestCase
|
class FasterFixturesTest < ActiveRecord::TestCase
|
||||||
fixtures :categories, :authors
|
fixtures :categories, :authors
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue