registration_spec.rb 960 B

12345678910111213141516171819202122232425262728293031323334
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Desktop > Registration', app: :desktop_view, authenticated_as: false, type: :system do
  4. notification_url = ''
  5. before do
  6. allow(NotificationFactory::Mailer).to receive(:notification) do |params|
  7. notification_url = params[:objects][:url]
  8. end
  9. end
  10. it 'Register a new user and log in with the confirmation link' do
  11. visit '/login'
  12. click_on 'Register'
  13. find_input('First name').type('John')
  14. find_input('Email').type('john.doe@example.com')
  15. find_input('Password').type('s3cr3tPassWord')
  16. find_input('Confirm password').type('s3cr3tPassWord')
  17. click_on 'Create my account'
  18. expect(page).to have_text('Thanks for joining. Email sent to "john.doe@example.com".')
  19. expect(notification_url).to be_present
  20. visit notification_url.sub(%r{.*/desktop/}, '')
  21. expect_current_route '/'
  22. end
  23. end