Sha256: f7fccdc99208cef382e6a010084873a107c6a3f74dbea15095adb5ba366dd441

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 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)
  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
  
  describe "exchange for oauth2 token" do
    before(:each) do
      @token = @verifier.exchange!
    end
    
    it "should invalidate verifier" do
      @verifier.should be_invalidated
    end
    
    it "should set user on token" do
      @token.user.should==@verifier.user
    end
    
    it "should set client application on token" do
      @token.client_application.should == @verifier.client_application
    end
    
    it "should be authorized" do
      @token.should be_authorized
    end
    
    it "should not be invalidated" do
      @token.should_not be_invalidated
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
oauth-plugin-0.4.0.pre7 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.pre6 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.pre5 generators/oauth_provider/templates/oauth2_verifier_spec.rb
insrc-oauth-plugin-0.4.0.pre6 generators/oauth_provider/templates/oauth2_verifier_spec.rb
insrc-oauth-plugin-0.4.0.pre5 generators/oauth_provider/templates/oauth2_verifier_spec.rb
le1t0-oauth-plugin-0.4.0.pre4.001 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.pre4 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.pre3 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.pre2 generators/oauth_provider/templates/oauth2_verifier_spec.rb
oauth-plugin-0.4.0.pre1 generators/oauth_provider/templates/oauth2_verifier_spec.rb