Sha256: 56062de295de41a52b3db52f22e30463eefd5f9837bbc2ec2e4a72fa747e6eb5

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

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

describe Tweetable::TwitterClient do 
  before do 
    RedisSpecHelper.reset
    stub_get('/1/account/rate_limit_status.json', 'rate_limit_status.json', {:login => 'l', :password => 'p'})
    stub_get('/1/account/verify_credentials.json', 'verify_credentials.json', {:login => 'l', :password => 'p'})
    
    @twitter = Tweetable::TwitterClient.new
  end

  context 'when not logged in' do
    it "should require login" do
      expect {
        @twitter.verify_credentials
      }.should raise_exception(Tweetable::TweetableAuthError)
    end
    
    it "should raise exception with nil authorization" do
      expect {
        @twitter.authorize(nil, nil, nil)
      }.should raise_exception(Tweetable::TweetableAuthError)
    end
    
  end
  
  context 'when logged in' do
    before do       
      @twitter.login('l', 'p')
    end
  
    it "should verify credentials of valid user" do
      info = @twitter.verify_credentials
      info.name.should == 'Peter T. Brown'
    end
  
    it "should get rate limit status" do
      @twitter.status.should include(:hourly_limit)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tweetable-0.1.14 spec/twitter_client_spec.rb
tweetable-0.1.13 spec/twitter_client_spec.rb
tweetable-0.1.11 spec/twitter_client_spec.rb
tweetable-0.1.10 spec/twitter_client_spec.rb