1
0

apps_controller_spec.rb 659 B

1234567891011121314151617181920212223242526
  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