闭社主体 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.

26 lines
659 B

  1. require 'rails_helper'
  2. RSpec.describe Api::V1::AppsController, type: :controller do
  3. render_views
  4. describe 'POST #create' do
  5. before do
  6. post :create, params: { client_name: 'Test app', redirect_uris: 'urn:ietf:wg:oauth:2.0:oob' }
  7. end
  8. it 'returns http success' do
  9. expect(response).to have_http_status(:success)
  10. end
  11. it 'creates an OAuth app' do
  12. expect(Doorkeeper::Application.find_by(name: 'Test app')).to_not be nil
  13. end
  14. it 'returns client ID and client secret' do
  15. json = body_as_json
  16. expect(json[:client_id]).to_not be_blank
  17. expect(json[:client_secret]).to_not be_blank
  18. end
  19. end
  20. end