Skip to content

Instantly share code, notes, and snippets.

@mugren
Created February 15, 2018 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mugren/106673a147f7721e31e9c3a57a0788d0 to your computer and use it in GitHub Desktop.
Save mugren/106673a147f7721e31e9c3a57a0788d0 to your computer and use it in GitHub Desktop.
Fixtures file loading order
# test/test_helper.rb
class ActiveRecord::FixtureSet
class << self
alias :orig_create_fixtures :create_fixtures
end
def self.create_fixtures f_dir, fs_names, *args
# delete priority ordering
UserItem.delete_all
reset_cache
# load priority ordering
fs_names = %w(users items) | fs_names
orig_create_fixtures f_dir, fs_names, *args
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment