spec/twhois_spec.rb in twhois-0.0.2 vs spec/twhois_spec.rb in twhois-0.0.3
- old
+ new
@@ -16,10 +16,20 @@
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('jimehoawhefoahelfhasdf')
+ 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
\ No newline at end of file