Permalink
Browse files

Only prefix numeric responses with message origin

  • Loading branch information...
1 parent 4498f5a commit 038e7caa83372957454732db9231ce2d1409dd3b @raws raws committed Jan 4, 2012
View
@@ -27,9 +27,10 @@ def initialize(command, *args)
@command = command.to_s.upcase
@args = args
- options = if args.last.is_a?(Hash) then args.pop else {} end
- @text = options[:text] if options[:text]
- @source = options[:source] || Hector.server_name
+ options = args.pop if args.last.is_a?(Hash)
+ @text = options[:text] if options
+ @source = options[:source] if options
+ @source ||= Hector.server_name if @command =~ /^\d+$/
end
def event_name
@@ -139,7 +139,7 @@ class ConnectionTest < IntegrationTest
test :"quitting should respond with an error" do
authenticated_connection.tap do |c|
c.receive_line "QUIT :bye"
- assert_sent_to c, ":hector.irc ERROR :Closing Link: sam[hector] (Quit: bye)"
+ assert_sent_to c, "ERROR :Closing Link: sam[hector] (Quit: bye)"
end
end
@@ -4,8 +4,8 @@ module Hector
class KeepAliveTest < IntegrationTest
test :"keep-alive ping is sent on pulse" do
authenticated_connection.tap do |c|
- assert_not_sent_to c, ":hector.irc PING hector.irc"
- assert_sent_to c, ":hector.irc PING hector.irc" do
+ assert_not_sent_to c, "PING hector.irc"
+ assert_sent_to c, "PING hector.irc" do
pulse(c)
end
assert !c.connection_closed?
@@ -16,7 +16,7 @@ class KeepAliveTest < IntegrationTest
authenticated_connection.tap do |c|
pulse(c)
c.receive_line "PONG hector.irc"
- assert_sent_to c, ":hector.irc PING hector.irc" do
+ assert_sent_to c, "PING hector.irc" do
pulse(c)
end
assert !c.connection_closed?
@@ -26,7 +26,7 @@ class KeepAliveTest < IntegrationTest
test :"not responding with pong results in disconnection on the next pulse" do
authenticated_connection.tap do |c|
pulse(c)
- assert_not_sent_to c, ":hector.irc PING hector.irc" do
+ assert_not_sent_to c, "PING hector.irc" do
pulse(c)
end
assert c.connection_closed?
@@ -12,7 +12,7 @@ class IrcErrorTest < TestCase
e
end
- assert_equal ":hector.irc FOO :This is a test\r\n", exception.response.to_s
+ assert_equal "FOO :This is a test\r\n", exception.response.to_s
assert !exception.fatal?
end
@@ -23,7 +23,7 @@ class IrcErrorTest < TestCase
e
end
- assert_equal ":hector.irc FOO bar :This is a test\r\n", exception.response.to_s
+ assert_equal "FOO bar :This is a test\r\n", exception.response.to_s
assert !exception.fatal?
end
@@ -34,7 +34,7 @@ class IrcErrorTest < TestCase
e
end
- assert_equal ":hector.irc FATAL\r\n", exception.response.to_s
+ assert_equal "FATAL\r\n", exception.response.to_s
assert exception.fatal?
end
end

0 comments on commit 038e7ca

Please sign in to comment.