In rails, a model
belongs_to :production_variety, class_name: 'Categoryminor'
the fixtures for categoryminors.yml has an entry
production_mel_lung:
id: 113
Yet, when running a test whether any of the following is provided for a fixture in this model's class
one:
production_variety: production_mel_lung.id
one:
production_variety: production_mel_lung
one:
production_variety_id: 113
for the unit test
culture = cultures(:one)
assert culture.valid?, culture.errors.full_messages.inspect
invariably returns
["Production variety must exist"]
Which is incorrect given the model definition. What must be done syntaxically to the fixtures to make this a proper test?
Aucun commentaire:
Enregistrer un commentaire