2016-09-26 14:55:21 -07:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2016-09-27 07:58:23 -07:00
|
|
|
RSpec.describe Api::V1::AppsController, type: :controller do
|
2016-09-26 14:55:21 -07:00
|
|
|
render_views
|
|
|
|
|
|
|
|
describe 'POST #create' do
|
|
|
|
before do
|
2016-09-30 14:08:29 -07:00
|
|
|
post :create, params: { client_name: 'Test app', redirect_uris: 'urn:ietf:wg:oauth:2.0:oob' }
|
2016-09-26 14:55:21 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns http success' do
|
|
|
|
expect(response).to have_http_status(:success)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates an OAuth app' do
|
|
|
|
expect(Doorkeeper::Application.find_by(name: 'Test app')).to_not be nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns client ID and client secret' do
|
|
|
|
json = body_as_json
|
|
|
|
|
|
|
|
expect(json[:client_id]).to_not be_blank
|
|
|
|
expect(json[:client_secret]).to_not be_blank
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|