1 require File.dirname(__FILE__) + '/../spec_helper'
2 module OAuthSpecHelpers
5 @consumer = OAuth::Consumer.new(@application.key,@application.secret,
7 :site => @application.oauth_server.base_url
11 def create_test_request
15 def create_oauth_request
16 @token = AccessToken.create :client_application => @application, :user => users(:quentin)
17 @request = @consumer.create_signed_request(:get, "/hello", @token)
20 def create_request_token_request
21 @request = @consumer.create_signed_request(:get, @application.oauth_server.request_token_path, @token)
24 def create_access_token_request
25 @token = RequestToken.create :client_application => @application
26 @request = @consumer.create_signed_request(:get, @application.oauth_server.request_token_path, @token)
31 describe ClientApplication do #, :shared => true do
32 include OAuthSpecHelpers
33 fixtures :users, :client_applications, :oauth_tokens
35 @application = ClientApplication.create :name => "Agree2", :url => "http://agree2.com", :user => users(:quentin)
39 it "should be valid" do
40 @application.should be_valid
44 it "should not have errors" do
45 @application.errors.full_messages.should == []
48 it "should have key and secret" do
49 @application.key.should_not be_nil
50 @application.secret.should_not be_nil
53 it "should have credentials" do
54 @application.credentials.should_not be_nil
55 @application.credentials.key.should == @application.key
56 @application.credentials.secret.should == @application.secret