Module: RailsCsvFixtures::TestFixturesPatch::ClassMethods

Defined in:
lib/rails-csv-fixtures/active_support_test_case_patch.rb

Instance Method Summary collapse

Instance Method Details

#fixtures_with_csv_support(*fixture_names) ⇒ Object

TODO: Figure out a better way to do this and still keep forward compatability instead of intercepting :all



13
14
15
16
17
18
19
20
21
22
# File 'lib/rails-csv-fixtures/active_support_test_case_patch.rb', line 13

def fixtures_with_csv_support(*fixture_names)
  # When using :all, intercept so we can list both the csv and yml files
  if fixture_names.first == :all
    fixture_names = Dir["#{fixture_path}/**/*.{csv,yml}"]
    fixture_names.map! { |f| f[(fixture_path.size + 1)..-5] }
  end

  # Continue on with all the names instead of :all
  fixtures_without_csv_support(*fixture_names)
end