RSpec.describe "Signup email verification", type: :system do
let(:mail) { ZeroDrop::Client.new }
it "verifies the account via emailed OTP" do
inbox = mail.generate_inbox
visit "/signup"
fill_in "Email", with: inbox
fill_in "Password", with: "TestPassword123!"
click_button "Create account"
email = mail.wait_for_latest(inbox, timeout: 15)
expect(email.otp).not_to be_nil
fill_in "Code", with: email.otp
click_button "Verify"
expect(page).to have_current_path("/dashboard")
end
end