Sha256: c6ba8e4577b0a542e0f4ea039251dd1eebfba15e243a9fe51f59e0dced51ea95

Contents?: true

Size: 1.45 KB

Versions: 17

Compression:

Stored size: 1.45 KB

Contents

shared_context "valid token", :token => :valid do
  let :token_string do
    "1A2B3C4D"
  end

  let :token do
    double(Doorkeeper::AccessToken, :accessible? => true)
  end

  before :each do
    Doorkeeper::AccessToken.stub(:authenticate).with(token_string).and_return(token)
  end
end

shared_context "invalid token", :token => :invalid do
  let :token_string do
    "1A2B3C4D"
  end

  let :token do
    double(Doorkeeper::AccessToken, :accessible? => false)
  end

  before :each do
    Doorkeeper::AccessToken.stub(:authenticate).with(token_string).and_return(token)
  end
end

shared_context "authenticated resource owner" do
  before do
    user = double(:resource, :id => 1)
    Doorkeeper.configuration.stub(:authenticate_resource_owner) { proc do user end }
  end
end

shared_context "not authenticated resource owner" do
  before do
    Doorkeeper.configuration.stub(:authenticate_resource_owner) { proc do redirect_to '/' end }
  end
end

shared_context "valid authorization request" do
  let :authorization do
    double(:authorization, :valid? => true, :authorize => true, :success_redirect_uri => "http://something.com/cb?code=token")
  end

  before do
    controller.stub(:authorization) { authorization }
  end
end

shared_context "invalid authorization request" do
  let :authorization do
    double(:authorization, :valid? => false, :authorize => false, :redirect_on_error? => false)
  end

  before do
    controller.stub(:authorization) { authorization }
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
doorkeeper-1.0.0.rc1 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.7.4 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.7.3 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.7.2 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.7.1 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.7.0 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.6.7 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.6.6 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.6.5 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.6.4 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.6.3 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.6.2 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.6.1 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.6.0 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.6.0.rc1 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.5.0 spec/support/shared/controllers_shared_context.rb
doorkeeper-0.5.0.rc1 spec/support/shared/controllers_shared_context.rb