Created
January 25, 2010 18:05
-
-
Save beccasaurus/286075 to your computer and use it in GitHub Desktop.
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
# You might want to do this in your before blocks in RSpec ... | |
before do | |
AuxCode.create_root_code! | |
AuxCode.load_from :colors => %w( red blue ), :genders => %w( male female ) | |
AuxCode.create_classes! | |
end | |
# create_root_code! will create an AuxCode with ID=0 (if one doesn't already exist) | |
# load_from will load up some data | |
# create_classes! will create the "fake" classes, eg. Color, if they don't already exist | |
# if you want no actual codes, just the categories ... | |
AuxCode.create_root_code! | |
AuxCode.create :name => 'Colors' | |
>> Color | |
NameError: uninitialized constant Color | |
>> AuxCode.create_classes! | |
=> [#<AuxCode @id=0 @aux_code_id=0 @name="Aux Code Categories" @meta=<not loaded>>, #<AuxCode @id=1 @aux_code_id=0 @name="Colors" @meta=<not loaded>>] | |
>> Color | |
=> Color | |
>> Color.count | |
=> 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment