about summary refs log tree commit diff
path: root/spec/controllers/oauth/authorizations_controller_spec.rb
blob: a5997bba3344fe5a91fe4b0011e327093ebc775e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Oauth::AuthorizationsController, type: :controller do
  render_views

  let(:app) { Doorkeeper::Application.create!(name: 'test', redirect_uri: 'http://localhost/') }

  before do
    sign_in Fabricate(:user), scope: :user
  end

  describe 'GET #new' do
    before do
      get :new, params: { client_id: app.uid, response_type: 'code', redirect_uri: 'http://localhost/' }
    end

    it 'returns http success' do
      expect(response).to have_http_status(:success)
    end

    it 'gives options to authorize and deny' do
      expect(response.body).to match(/Authorize/)
    end
  end
end