test/unit/plugin/alias_test.rb in robut-0.3.0 vs test/unit/plugin/alias_test.rb in robut-0.4.0

- old
+ new

@@ -4,11 +4,12 @@ class Robut::Plugin::AliasTest < Test::Unit::TestCase def setup @connection = Robut::ConnectionMock.new - @plugin = Robut::Plugin::Alias.new(@connection) + @presence = Robut::PresenceMock.new(@connection) + @plugin = Robut::Plugin::Alias.new(@presence) @plugin.aliases = {} end def test_aliases_this_to_that @plugin.handle(Time.now, "@john", "@robut alias w weather?") @@ -16,11 +17,11 @@ end def test_thinks_this_is_that @plugin.handle(Time.now, "@john", "@robut alias this @robut echo that") @plugin.handle(Time.now, "@john", "this") - message = @plugin.connection.messages.first + message = @plugin.reply_to.messages.first assert_equal "@john", message[1] assert_equal "@robut echo that", message[2] end def test_doesnt_alias_when_it_shouldnt @@ -34,11 +35,11 @@ end def test_can_apply_aliases_with_quotes @plugin.handle(Time.now, "@john", '@robut alias "long string" "some other long string"') @plugin.handle(Time.now, "@john", "long string") - message = @plugin.connection.messages.first + message = @plugin.reply_to.messages.first assert_equal "@john", message[1] assert_equal "some other long string", message[2] end def test_aliases_can_be_removed @@ -61,10 +62,10 @@ def test_can_list_all_aliases @plugin.handle(Time.now, "@john", "@robut alias this that") @plugin.handle(Time.now, "@john", "@robut alias something something else") @plugin.handle(Time.now, "@john", "@robut aliases") - assert_equal ["something => something else\nthis => that"], @plugin.connection.replies + assert_equal ["something => something else\nthis => that"], @plugin.reply_to.replies end def test_can_clear_aliases @plugin.handle(Time.now, "@john", "@robut alias this that") @plugin.handle(Time.now, "@john", "@robut clear aliases")