闭社主体 forked from https://github.com/tootsuite/mastodon
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.

42 lines
901 B

  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