logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

authorized_applications_controller_spec.rb (901B)


  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Oauth::AuthorizedApplicationsController do
  4. render_views
  5. describe 'GET #index' do
  6. subject do
  7. get :index
  8. end
  9. shared_examples 'stores location for user' do
  10. it 'stores location for user' do
  11. subject
  12. expect(controller.stored_location_for(:user)).to eq "/oauth/authorized_applications"
  13. end
  14. end
  15. context 'when signed in' do
  16. before do
  17. sign_in Fabricate(:user), scope: :user
  18. end
  19. it 'returns http success' do
  20. subject
  21. expect(response).to have_http_status(:success)
  22. end
  23. include_examples 'stores location for user'
  24. end
  25. context 'when not signed in' do
  26. it 'redirects' do
  27. subject
  28. expect(response).to redirect_to '/auth/sign_in'
  29. end
  30. include_examples 'stores location for user'
  31. end
  32. end
  33. end