From 7e14eefc819ce27f45406452a4f8e2039d0f0886 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 26 Sep 2016 23:55:21 +0200 Subject: Replace logo, fix #57 - delete/unreblog/unfavourite API, fix #45 - app registration API --- spec/controllers/api/apps_controller_spec.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spec/controllers/api/apps_controller_spec.rb (limited to 'spec/controllers/api/apps_controller_spec.rb') diff --git a/spec/controllers/api/apps_controller_spec.rb b/spec/controllers/api/apps_controller_spec.rb new file mode 100644 index 000000000..ebadddde2 --- /dev/null +++ b/spec/controllers/api/apps_controller_spec.rb @@ -0,0 +1,26 @@ +require 'rails_helper' + +RSpec.describe Api::AppsController, type: :controller do + render_views + + describe 'POST #create' do + before do + post :create, params: { name: 'Test app', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob' } + 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 -- cgit