简体   繁体   中英

Rails Testing : Array to be loaded in fixtures

I have an array of data whose presence I need to check in method, and now I have to write a test cases for that using MiniTest. Now issue is how to load the array in fixture because fixture only contains hashes or array inside hashes.

eg

HUMAN_SPECIES = [INDIAN, AMERICAN, AFRICAN, RUSSIAN]

def allow_human
  HUMAN_SPECIES.include?(human_species)
    # Statement
end.

Need to write HUMAN_SPECIES in fixture.yml. How ?

Any help will be appreciated

This must work:

model_name_test:
  human_species:
    - INDIAN
    - AFRICAN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM