Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

mock_bot rewritten to pass tests with Eventmachine backend #14

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ericgj
Copy link

@ericgj ericgj commented Feb 26, 2011

I redesigned mock_bot to work with Eventmachine, so the tests pass, with minimal changes. See what you think.

  • I made one small change to the code, to split the IRC < EM::Connection class from the methods that get mixed into the connection: this made it easier to test these methods in isolation from the EM reactor.
  • Because the whole reactor is stubbed out when you use mock_bot, any time your tests write to the @server (simulating a response from the server), you have to manually call receive_data with the contents of the @socket. Luckily, most of the server responses we care about are done in one place, bot_is_connected. You may find a better way to do this than I did. It's a little like a hand-cranked car, but it works :)

Thanks for a great little tool and excellent code BTW - learned a lot reading it.

@ericgj
Copy link
Author

ericgj commented Feb 27, 2011

PS. the commit to pull from is a44fda2. The further commits listed above are for features I've started to add to my fork - namely, ability to configure bots from external file; and ability to auto-join channels. If you like I can submit pull requests for these feature branches separately (I've added tests for them and they all pass).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant