Sha256: 63a8d29c68bb1ea4c507f74f214c0557c636f2549e1fd4777273c718111725d1

Contents?: true

Size: 1.16 KB

Versions: 21

Compression:

Stored size: 1.16 KB

Contents

module AuthorizationRequestHelper
  def resource_owner_is_authenticated(resource_owner = nil)
    resource_owner ||= User.create!(:name => "Joe", :password => "sekret")
    Doorkeeper.configuration.instance_variable_set(:@authenticate_resource_owner, proc { resource_owner })
  end

  def resource_owner_is_not_authenticated
    Doorkeeper.configuration.instance_variable_set(:@authenticate_resource_owner, proc { redirect_to("/sign_in") })
  end

  def default_scopes_exist(*scopes)
    Doorkeeper.configuration.instance_variable_set(:@default_scopes, Doorkeeper::OAuth::Scopes.from_array(scopes))
  end

  def optional_scopes_exist(*scopes)
    Doorkeeper.configuration.instance_variable_set(:@optional_scopes, Doorkeeper::OAuth::Scopes.from_array(scopes))
  end

  def client_should_be_authorized(client)
    client.should have(1).access_grants
  end

  def client_should_not_be_authorized(client)
    client.should have(0).access_grants
  end

  def i_should_be_on_client_callback(client)
    client.redirect_uri.should == "#{current_uri.scheme}://#{current_uri.host}#{current_uri.path}"
  end
end

RSpec.configuration.send :include, AuthorizationRequestHelper, :type => :request

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
doorkeeper-1.0.0.rc2 spec/support/helpers/authorization_request_helper.rb
doorkeeper-1.0.0.rc1 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.7.4 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.7.3 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.7.2 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.7.1 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.7.0 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.6.7 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.6.6 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.6.5 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.6.4 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.6.3 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.6.2 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.6.1 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.6.0 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.6.0.rc1 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.5.0 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.5.0.rc1 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.4.2 spec/support/helpers/authorization_request_helper.rb
doorkeeper-0.4.1 spec/support/helpers/authorization_request_helper.rb