FactoryGirl.define do factory :variant, class: Strain::Variant do schema_hash = { "type": "object", "properties": { "summary": {"type": "string"}, "main": {"type": "string"} }, "additionalProperties": false } name "test" schema schema_hash trait :nested_schema do schema_hash = { "type": "object", "additionalProperties": false, "properties": { "summary": {"type": "string"}, "main": { "type": "object", "additionalProperties": false, "properties": { "section_title": {"type": "string"}, "section_text": {"type": "string"} } } } } schema schema_hash end end end