Sha256: 4a1c908c6d57a598dda71a437589c4dc4bba47b750e91b8cf88c00c2ba7294e0

Contents?: true

Size: 1018 Bytes

Versions: 2

Compression:

Stored size: 1018 Bytes

Contents

require 'spec_helper'

describe Twhois do
  
  it "should find author's twitter account" do
    user = Twhois.lookup('jimeh')
    user.screen_name.should == "jimeh"
    user.lang.should == "en"
    user.profile_image_url.should_not be_nil
    user.name.should_not be_nil
    user.location.should_not be_nil
    user.url.should_not be_nil
    user.followers_count.should_not be_nil
    user.description.should_not be_nil
    user.time_zone.should_not be_nil
    user.profile_background_image_url.should_not be_nil
    # ...that should be enough
  end
  
  it "should return error on unknown user" do
    user = Twhois.lookup('akjsdfkjasdfasd')
    user.should be_nil
  end
  
  it "should raise an exception on invalid usernames" do
    lambda { # invalid characters
      user = Twhois.lookup("abc/damn")
    }.should raise_error(Twhois::InvalidUsername)
    
    lambda { # longer than 15 characters
      user = Twhois.lookup("abcasdjfakajsdfasdfasdfa")
    }.should raise_error(Twhois::InvalidUsername)
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twhois-0.0.4 spec/twhois_spec.rb
twhois-0.0.3 spec/twhois_spec.rb