Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "../lib/gort/message"
- describe GORT::Message, "#new" do
- def parse(message, event, args = {})
- defaults = { :nick => "pauldaniels", :user => "~debbie", :host => "mcg.ee",
- :channel => "#heis", :message => "that's magic"
- }
- args = defaults.merge args
- msg = GORT::Message.new message
- msg.nick.should == args[:nick]
- msg.user.should == args[:user]
- msg.host.should == args[:host]
- msg.event.should == event
- msg.channel.should == args[:channel]
- msg.message.should == args[:message]
- msg.target.should == args[:target]
- end
- it "should parse PRIVMSGs" do
- parse ":pauldaniels!~debbie@mcg.ee PRIVMSG #heis :that's magic", :channel
- parse ":pauldaniels!~debbie@mcg.ee PRIVMSG GORT :that's magic", :private, :channel => nil
- end
- it "should parse CTCPs" do
- parse ":pauldaniels!~debbie@mcg.ee PRIVMSG #heis :\x01that's magic\x01", :ctcp
- parse ":pauldaniels!~debbie@mcg.ee PRIVMSG GORT :\x01that's magic\x01", :ctcp, :channel => nil
- end
- it "should parse ACTIONs" do
- parse ":pauldaniels!~debbie@mcg.ee PRIVMSG #heis :\x01ACTION that's magic\x01", :action
- parse ":pauldaniels!~debbie@mcg.ee PRIVMSG GORT :\x01ACTION that's magic\x01", :action, :channel => nil
- end
- it "should parse CTCP replies" do
- parse ":pauldaniels!~debbie@mcg.ee NOTICE GORT :\x01that's magic\x01", :ctcpreply, :channel => nil
- end
- it "should parse NOTICEs" do
- parse ":pauldaniels!~debbie@mcg.ee NOTICE #heis :that's magic", :notice
- parse ":pauldaniels!~debbie@mcg.ee NOTICE GORT :that's magic", :notice, :channel => nil
- end
- it "should parse JOINs" do
- parse ":pauldaniels!~debbie@mcg.ee JOIN :#heis", :join, :message => nil
- end
- it "should parse PARTs" do
- parse ":pauldaniels!~debbie@mcg.ee PART #heis :that's magic", :part
- end
- it "should parse QUITs" do
- parse ":pauldaniels!~debbie@mcg.ee QUIT :that's magic", :quit, :channel => nil
- end
- it "should parse NICK changes" do
- parse ":pauldaniels!~debbie@mcg.ee NICK :davidblaine", :nick, :channel => nil, :message => nil, :target => "davidblaine"
- end
- it "should parse TOPIC changes" do
- parse ":pauldaniels!~debbie@mcg.ee TOPIC #heis :that's magic", :topic
- end
- it "should parse MODEs" do
- parse ":pauldaniels!~debbie@mcg.ee MODE #heis +o GORT pauldaniels debbiemcgee", :mode, :message => "+o", :target => ["GORT", "pauldaniels", "debbiemcgee"]
- end
- it "should parse PINGs" do
- parse "PING :irc.daemon.org", :ping, :message => "irc.daemon.org", :channel => nil, :user => nil, :host => nil, :nick => nil
- end
- ## ++ add some parsing for significant numerics
- it "should parse raw numerics" do
- parse ":irc.daemon.org 366 GORT #heis :End of NAMES list", :_366, :nick => nil, :user => nil, :host => nil, :channel => nil, :target => "GORT", :message => "#heis End of NAMES list"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement