spec: simplify export template factory
This commit is contained in:
parent
5846fb4417
commit
06cbb65d4e
5 changed files with 31 additions and 19 deletions
|
@ -11,24 +11,36 @@ FactoryBot.define do
|
|||
{ "type" => "paragraph", "content" => [{ "text" => "export_", "type" => "text" }, { "type" => "mention", "attrs" => { "id" => "dossier_id", "label" => "id dossier" } }, { "text" => " .pdf", "type" => "text" }] }
|
||||
]
|
||||
},
|
||||
"default_dossier_directory" =>
|
||||
{
|
||||
"type" => "doc",
|
||||
"content" =>
|
||||
[
|
||||
{
|
||||
"type" => "paragraph",
|
||||
"content" =>
|
||||
[
|
||||
{ "text" => "dossier_", "type" => "text" },
|
||||
{ "type" => "mention", "attrs" => { "id" => "dossier_number", "label" => "numéro du dossier" } },
|
||||
{ "text" => " ", "type" => "text" }
|
||||
]
|
||||
"default_dossier_directory" => {
|
||||
"type" => "doc",
|
||||
"content" =>
|
||||
[
|
||||
{
|
||||
"type" => "paragraph",
|
||||
"content" =>
|
||||
[
|
||||
{ "text" => "dossier_", "type" => "text" },
|
||||
{ "type" => "mention", "attrs" => { "id" => "dossier_number", "label" => "numéro du dossier" } },
|
||||
{ "text" => " ", "type" => "text" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
kind { "zip" }
|
||||
|
||||
to_create do |export_template, _context|
|
||||
export_template.set_default_values
|
||||
export_template.save
|
||||
end
|
||||
|
||||
trait :with_custom_content do
|
||||
to_create do |export_template, context|
|
||||
export_template.set_default_values
|
||||
export_template.content = context.content
|
||||
export_template.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue