Permalink
Browse files

Merge pull request #9861 from pivotalcommon/master

Allow fixture_path to be a Pathname
  • Loading branch information...
2 parents ecfdc84 + 018fc5f commit a7391f58a0189474ef93ae89541fa34f6333e786 @jeremy jeremy committed Mar 21, 2013
Showing with 10 additions and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/fixtures.rb
  2. +9 −0 activerecord/test/cases/fixtures_test.rb
@@ -752,7 +752,7 @@ def set_fixture_class(class_names = {})
def fixtures(*fixture_set_names)
if fixture_set_names.first == :all
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
fixture_set_names = fixture_set_names.flatten.map { |n| n.to_s }
end
@@ -576,6 +576,15 @@ def test_all_there
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
fixtures :categories, :authors

0 comments on commit a7391f5

Please sign in to comment.