Sha256: bbfda7f7a867dd3fd941be3e101802f5124293af329f1b8b320640110ba805fc

Contents?: true

Size: 1.19 KB

Versions: 18

Compression:

Stored size: 1.19 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Oauth2Verifier do
  fixtures :client_applications, :users, :oauth_tokens
  before(:each) do
    @verifier = Oauth2Verifier.create :client_application => client_applications(:one), :user=>users(:aaron), :scope => "bbbb aaaa"
  end

  it "should be valid" do
    @verifier.should be_valid
  end

  it "should have a code" do
    @verifier.code.should_not be_nil
  end

  it "should not have a secret" do
    @verifier.secret.should be_nil
  end

  it "should be authorized" do
    @verifier.should be_authorized
  end

  it "should not be invalidated" do
    @verifier.should_not be_invalidated
  end

  it "should generate query string" do
    @verifier.to_query.should == "code=#{@verifier.code}"
    @verifier.state="bbbb aaaa"
    @verifier.to_query.should == "code=#{@verifier.code}&state=bbbb%20aaaa"
  end

  it "should properly exchange for token" do
    @token = @verifier.exchange!
    @verifier.should be_invalidated
    @token.user.should==@verifier.user
    @token.client_application.should == @verifier.client_application
    @token.should be_authorized
    @token.should_not be_invalidated
    @token.scope.should == @verifier.scope
  end
end

Version data entries

18 entries across 9 versions & 4 rubygems

Version Path
houston-oauth-plugin-0.5.1 lib/generators/rspec/templates/oauth2_verifier_spec.rb
houston-oauth-plugin-0.5.1 generators/oauth_provider/templates/oauth2_verifier_spec.rb
panjiva-oauth-plugin-0.4.1 lib/generators/rspec/templates/oauth2_verifier_spec.rb
panjiva-oauth-plugin-0.4.1 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.5.1 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.5.1 lib/generators/rspec/templates/oauth2_verifier_spec.rb
oauth-plugin-0.5.0 lib/generators/rspec/templates/oauth2_verifier_spec.rb
oauth-plugin-0.5.0 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-provider-0.5.0rc1 lib/generators/rspec/templates/oauth2_verifier_spec.rb
oauth-provider-0.5.0rc1 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.1 lib/generators/rspec/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.1 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0 lib/generators/rspec/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.rc2 lib/generators/rspec/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.rc2 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.rc1 lib/generators/rspec/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.rc1 generators/oauth_provider/templates/oauth2_verifier_spec.rb