The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 lines
1.6 KiB

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Auth::ConfirmationsController, type: :controller do
  4. render_views
  5. describe 'GET #new' do
  6. it 'returns http success' do
  7. @request.env['devise.mapping'] = Devise.mappings[:user]
  8. get :new
  9. expect(response).to have_http_status(200)
  10. end
  11. end
  12. describe 'GET #show' do
  13. context 'when user is unconfirmed' do
  14. let!(:user) { Fabricate(:user, confirmation_token: 'foobar', confirmed_at: nil) }
  15. before do
  16. allow(BootstrapTimelineWorker).to receive(:perform_async)
  17. @request.env['devise.mapping'] = Devise.mappings[:user]
  18. get :show, params: { confirmation_token: 'foobar' }
  19. end
  20. it 'redirects to login' do
  21. expect(response).to redirect_to(new_user_session_path)
  22. end
  23. it 'queues up bootstrapping of home timeline' do
  24. expect(BootstrapTimelineWorker).to have_received(:perform_async).with(user.account_id)
  25. end
  26. end
  27. context 'when user is updating email' do
  28. let!(:user) { Fabricate(:user, confirmation_token: 'foobar', unconfirmed_email: 'new-email@example.com') }
  29. before do
  30. allow(BootstrapTimelineWorker).to receive(:perform_async)
  31. @request.env['devise.mapping'] = Devise.mappings[:user]
  32. get :show, params: { confirmation_token: 'foobar' }
  33. end
  34. it 'redirects to login' do
  35. expect(response).to redirect_to(new_user_session_path)
  36. end
  37. it 'does not queue up bootstrapping of home timeline' do
  38. expect(BootstrapTimelineWorker).to_not have_received(:perform_async)
  39. end
  40. end
  41. end
  42. end