test/ikachan_test.rb in ikachan-0.0.1 vs test/ikachan_test.rb in ikachan-0.0.2
- old
+ new
@@ -41,9 +41,27 @@
Net::HTTP::Post.expects(:new).with('/notice').returns(req)
Ikachan.notice('foo bar buzz')
end
+ def test_privmsg
+ Ikachan.expects(:join)
+
+ http = mock('http')
+ http.stub_everything
+ http.expects(:request)
+ Net::HTTP.expects(:new).with('irc.example.com', 4649).returns(http)
+
+ req = mock('req')
+ req.stub_everything
+ req.expects(:form_data=).with do |params|
+ (params['channel'] == '#example') && (params['message'] == 'foo bar buzz')
+ end
+ Net::HTTP::Post.expects(:new).with('/privmsg').returns(req)
+
+ Ikachan.privmsg('foo bar buzz')
+ end
+
def test_rescue_timeout_error
Ikachan.expects(:join)
http = stub('http')
http.stub_everything