Sha256: 73c13de1c158a9809607032667fe00b9f8c62dc008c24ee42ef610f1a1fd6242
Contents?: true
Size: 906 Bytes
Versions: 9
Compression:
Stored size: 906 Bytes
Contents
require 'helper' describe Safubot::Bot do before(:all) do Safubot::Test.clean_environment end it 'should respond to basic queries' do $bot.once(:request) do |req| $bot.respond(req, "Pumpkin!") end $bot.answer("Pumpkin?").should == "Pumpkin!" end it 'should process requests with correct delegation' do req = Safubot::Test.request("Hello!") fired = false $bot.once(:request) do |request| request.should == req fired = true end $bot.process_request(req) do req.processed.should == true fired.should == true end end it 'should add a response to the queue' do req = Safubot::Test.request("Silly bot is silly.") $bot.once(:request) do |request| $bot.respond(req, "I am not silly! :<") end $bot.process_request(req) req.responses.count.should == 1 req.responses.first.request.should == req req.responses.first.text.should == "I am not silly! :<" end end
Version data entries
9 entries across 9 versions & 1 rubygems