I'm using fabrication with rails, and I normally have more than one fabricator for each class/model. I found myself, creating many
Fabricator :somethng, from: :class_name
I found this repetitive, because it's obvious that in that file, every fabricator should inherit the class, for instance
# spec/fabricator/disease_fabricator.rb
Fabricator :disease do; end
Fabricator :asthma, from: :disease do
name "Asthma"
shortname "asthma"
description "Asthma is a common chronic inflammatory disease of the airways characterized by variable and recurring symptoms, reversible airflow obstruction and bronchospasm"
icpc2 "R96"
end
Fabricator :copd, from: :disease do
name "chronic obstructive plmonary dz"
shorname "copd"
description "blablaba"
icpc2 "R93"
end
I remember that factory girls, allows somehing like:
Factory :disease do
Factory :asthma do
name "Asthma"
shortname "asthma"
description "Asthma is a common chronic inflammatory disease of the airways characterized by variable and recurring symptoms, reversible airflow obstruction and bronchospasm"
icpc2 "R96"
end
Factory :copd do
name "chronic obstructive plmonary dz"
shorname "copd"
description "blablaba"
icpc2 "R93"
end
end
(I'm not quite sure about the syntax, but it was something like that).
Anyway, if I'm using rails, and is running disease_fabricator, it makes sense that by default it should be assumed that every Fabricator defined belongs to that class.
Is this behaviour possible?