Sha256: 4931ed1baf0d3958d3ecfe1c50d004efa5fb97613026c1378eb65769051108ab

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
couchkeeper-0.6.7 spec/requests/flows/skip_authorization_spec.rb