Permalink
Browse files

use File.basename to get the filename minus .yml

  • Loading branch information...
1 parent 508493c commit 00c5342d96a3677c0a6a2bb8316c76182f5bdfdd @tenderlove tenderlove committed Jan 3, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 activerecord/lib/active_record/fixtures.rb
@@ -754,8 +754,9 @@ def set_fixture_class(class_names = {})
def fixtures(*fixture_names)
if fixture_names.first == :all
- fixture_names = Dir["#{fixture_path}/**/*.{yml}"]
- fixture_names.map! { |f| f[(fixture_path.size + 1)..-5] }
+ fixture_names = Dir["#{fixture_path}/**/*.yml"].map { |f|
+ File.basename f, '.yml'
+ }
else
fixture_names = fixture_names.flatten.map { |n| n.to_s }
end

2 comments on commit 00c5342

Owner

pixeltrix replied Nov 8, 2012

This breaks namespaced fixtures when using fixtures :all as the File.basename strips off any namespace. The tests didn't catch it because they're specified individually. Any objection to just reverting this or would you prefer it written some other way?

Owner

tenderlove replied Dec 18, 2012

@pixeltrix nah, I'll just revert it. I suppose we should figure out a test for this. :(

Please sign in to comment.