sessions_controller_spec.rb 815 B

123456789101112131415161718192021222324252627282930
  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