0
Je reçois l'erreur suivante:Rspec & ShouldaMatchers avec nom_classe
1) Admin should belong to hospital
Failure/Error: it {should belong_to(:hospital).with_foreign_key('medical_facility_id') }
Expected Admin to have a belongs_to association called hospital()
avec:
#admin_spec.rb
it {should belong_to(:hospital).with_foreign_key('medical_facility_id') }
modèles sont les suivants:
class Admin < ActiveRecord::Base
belongs_to :hospital
end
class Hospital < MedicalFacility
end
En schema.rb
:
create_table "admins", force: :cascade do |t|
t.integer "user_id", null: false
t.string "role", null: false
t.integer "medical_facility_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
Comment écrire correctement un test pour ce modèle? Peut-être devrais-je ajouter `class_name:" MedicalFacility "au modèle Admin?