Created
February 15, 2018 21:00
-
-
Save mugren/106673a147f7721e31e9c3a57a0788d0 to your computer and use it in GitHub Desktop.
Fixtures file loading order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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