diff --git a/spec/factories/edition.rb b/spec/factories/edition.rb index f85e4bcc7..4e049534b 100644 --- a/spec/factories/edition.rb +++ b/spec/factories/edition.rb @@ -94,16 +94,4 @@ schema_name { "contact" } document_type { "contact" } end - - factory :live_edition_with_embedded_content, parent: :edition do - base_path { "/#{SecureRandom.uuid}" } - details { { body: "{{embed:#{embedded_content_type}:#{embedded_content_id}" } } - state { "published" } - - transient do - embedded_content_id { SecureRandom.uuid } - embedded_content_type { "content_block_email_address" } - links_hash { { embed: [embedded_content_id] } } - end - end end diff --git a/spec/factories/live_edition.rb b/spec/factories/live_edition.rb index ba7b5751d..d21b37b4b 100644 --- a/spec/factories/live_edition.rb +++ b/spec/factories/live_edition.rb @@ -29,6 +29,17 @@ with_draft end + trait :with_embedded_content do + base_path { "/#{SecureRandom.uuid}" } + details { { body: "{{embed:#{embedded_content_type}:#{embedded_content_id}" } } + + transient do + embedded_content_id { SecureRandom.uuid } + embedded_content_type { "content_block_email_address" } + links_hash { { embed: [embedded_content_id] } } + end + end + after(:create) do |live_edition, evaluator| unless evaluator.published_at live_edition.update!(published_at: live_edition.created_at) diff --git a/spec/service_consumers/pact_helper.rb b/spec/service_consumers/pact_helper.rb index 88bbc153a..0ec933563 100644 --- a/spec/service_consumers/pact_helper.rb +++ b/spec/service_consumers/pact_helper.rb @@ -657,7 +657,8 @@ def url_encode(str) reusable_edition = create(:live_edition, document: reusable_document) document = create(:document, content_id: "d66d6552-2627-4451-9dbc-cadbbd2005a1") - live_edition_with_embedded_edition = create(:live_edition_with_embedded_content, + live_edition_with_embedded_edition = create(:live_edition, + :with_embedded_content, document:, embedded_content_id: reusable_edition.content_id, title: "foo",