Sha256: 5e6352756519937d7e1acdff76a7d6e63ad1172c8e1359c3019fa2ca18394339

Contents?: true

Size: 1.34 KB

Versions: 23

Compression:

Stored size: 1.34 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

23 entries across 23 versions & 1 rubygems

Version Path
doorkeeper-1.1.0 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-1.0.0 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-1.0.0.rc2 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-1.0.0.rc1 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.7.4 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.7.3 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.7.2 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.7.1 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.7.0 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.6.7 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.6.6 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.6.5 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.6.4 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.6.3 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.6.2 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.6.1 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.6.0 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.6.0.rc1 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.5.0 spec/requests/flows/skip_authorization_spec.rb
doorkeeper-0.5.0.rc1 spec/requests/flows/skip_authorization_spec.rb