Files
grecia/spec/support/common_actions/emails.rb
Javi Martín 29ab5cebd4 Don't access the database in direct message tests
As mentioned in commits like a586ba806, a7664ad81, 006128da5, b41fbfa52
and c480cdd91, accessing the database after starting the browser with
the `visit` method sometimes results in database corruption and failing
tests on our CI due to the process running the test accessing the
database after the process running the browser has started.

Note that, in this case, in order to make the tests more readable, we're
adding a bit of duplication. We should probably simplify these tests by
moving most of the checks to mailer tests and then we could remove the
duplication. The alternative would be to make the
`create_direct_message` method way more complex than it is right now.
2025-04-01 14:53:26 +02:00

10 lines
444 B
Ruby

module Emails
def fill_in_newsletter_form(options = {})
select (options[:segment_recipient] || "All users"), from: "Recipients"
fill_in "Subject", with: options[:subject] || "This is a different subject"
fill_in "E-mail address that will appear as sending the newsletter",
with: options[:from] || "no-reply@consul.dev"
fill_in_ckeditor "Email content", with: options[:body] || "This is a different body"
end
end