Sha256: 48c4a250881d13723f680dab1e9b33ee76306c448ab12034cf8325a649e9ef7e

Contents?: true

Size: 1.32 KB

Versions: 14

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper_integration'

feature 'Skip authorization form' do
  background do
    config_is_set(:authenticate_resource_owner) { User.first || redirect_to('/sign_in') }
    client_exists
    default_scopes_exist  :public
    optional_scopes_exist :write
  end

  context 'for previously authorized clients' do
    background do
      create_resource_owner
      sign_in
    end

    scenario 'skips the authorization and return a new grant code' do
      client_is_authorized(@client, @resource_owner, scopes: 'public')
      visit authorization_endpoint_url(client: @client)

      i_should_not_see 'Authorize'
      client_should_be_authorized @client
      i_should_be_on_client_callback @client
      url_should_have_param 'code', Doorkeeper::AccessGrant.first.token
    end

    scenario 'does not skip authorization when scopes differ' do
      client_is_authorized(@client, @resource_owner, scopes: 'public write')
      visit authorization_endpoint_url(client: @client, scope: 'public')
      i_should_see 'Authorize'
    end

    scenario 'creates grant with new scope when scopes differ' do
      client_is_authorized(@client, @resource_owner, scopes: 'public write')
      visit authorization_endpoint_url(client: @client, scope: 'public')
      click_on 'Authorize'
      access_grant_should_have_scopes :public
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
doorkeeper-1.4.2 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-2.1.2 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-2.1.1 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-2.1.0 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-2.0.1 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-1.4.1 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-2.0.0 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-2.0.0.rc3 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-2.0.0.rc2 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-2.0.0.alpha1 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-1.4.0 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-1.3.1 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-1.3.0 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-1.2.0 spec/requests/flows/skip_authorization_spec.rb