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.

30 lines
815 B

  1. require 'rails_helper'
  2. describe Settings::SessionsController do
  3. render_views
  4. let(:user) { Fabricate(:user) }
  5. let(:session_activation) { Fabricate(:session_activation, user: user) }
  6. before { sign_in user, scope: :user }
  7. describe 'DELETE #destroy' do
  8. subject { delete :destroy, params: { id: id } }
  9. context 'when session activation exists' do
  10. let(:id) { session_activation.id }
  11. it 'destroys session activation' do
  12. is_expected.to redirect_to edit_user_registration_path
  13. expect(SessionActivation.find_by(id: id)).to be_nil
  14. end
  15. end
  16. context 'when session activation does not exist' do
  17. let(:id) { session_activation.id + 1000 }
  18. it 'destroys session activation' do
  19. is_expected.to have_http_status :not_found
  20. end
  21. end
  22. end
  23. end