Skip to content

Commit

Permalink
Update feature tests to use presenter
Browse files Browse the repository at this point in the history
This DRYs things up a bit
  • Loading branch information
pezholio committed Dec 10, 2024
1 parent dbd4078 commit 1d07b32
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,14 @@
end

And("I should be taken to the confirmation page for a published block") do
assert_text "Email address published"
assert_text "You can now view the updated content block. If you need any support or want to delete a content block you can raise a support request."
content_block_edition = ContentBlockManager::ContentBlock::Edition.last

assert_text ContentBlockManager::ConfirmationCopyPresenter::UpdatedBlock.new(content_block_edition).for_panel
assert_text ContentBlockManager::ConfirmationCopyPresenter::UpdatedBlock.new(content_block_edition).for_paragraph
expect(page).to have_link(
"View content block",
href: content_block_manager.content_block_manager_content_block_document_path(
ContentBlockManager::ContentBlock::Edition.last.document,
content_block_edition.document,
),
)

Expand All @@ -171,13 +173,15 @@ def has_support_button
end

And("I should be taken to the confirmation page for a new block") do
assert_text "Email address created"
assert_text "You can now view the content block. If you need any support or want to delete a content block you can raise a support request."
content_block = ContentBlockManager::ContentBlock::Edition.last

assert_text ContentBlockManager::ConfirmationCopyPresenter::NewBlock.new(content_block).for_panel
assert_text ContentBlockManager::ConfirmationCopyPresenter::NewBlock.new(content_block).for_paragraph

expect(page).to have_link(
"View content block",
href: content_block_manager.content_block_manager_content_block_document_path(
ContentBlockManager::ContentBlock::Edition.last.document,
content_block.document,
),
)

Expand All @@ -191,13 +195,15 @@ def has_support_button
end

When("I should be taken to the scheduled confirmation page") do
assert_text "Email address scheduled to publish on"
assert_text "You can now view the updated schedule of the content block."
content_block_edition = ContentBlockManager::ContentBlock::Edition.last

assert_text ContentBlockManager::ConfirmationCopyPresenter::ScheduledBlock.new(content_block_edition).for_panel.squish
assert_text ContentBlockManager::ConfirmationCopyPresenter::ScheduledBlock.new(content_block_edition).for_paragraph

expect(page).to have_link(
"View content block",
href: content_block_manager.content_block_manager_content_block_document_path(
ContentBlockManager::ContentBlock::Edition.last.document,
content_block_edition.document,
),
)

Expand Down

0 comments on commit 1d07b32

Please sign in to comment.