Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

allow user to send message from a room in tests #120

Merged
merged 5 commits into from
Jun 18, 2015

Conversation

nickjer
Copy link

@nickjer nickjer commented Jun 15, 2015

Allows developers to write specs that have users sending messages directly to the bot or from a room. Makes it easier to test private and public messages.

Allows developers to write specs that have users sending messages directly to the bot or from a room. Makes it easier to test private and public messages.
@jimmycuadra
Copy link
Collaborator

Good addition! Let's make it accept a Lita::Room object instead of a string. Rooms as strings will slowly be phased out now that there's a real room object, so any new APIs should use them.

@nickjer
Copy link
Author

nickjer commented Jun 17, 2015

Thanks. I have been using it extensively to check whether a message was public or private in a game I am building.

Also, I am not quite sure what you mean by "make it accept Lita::Room". There is really nothing stopping it from accepting it. In fact I already send it Lita::Room

Here is a snippet from one of my personal specs

let (:room) { Lita::Room.create_or_update(555, name: "Room") }
...
before(:example) do
  send_message(".play", from: room)
end

Let me know if you need me to change something.

@jimmycuadra
Copy link
Collaborator

Yes, you're right. I guess all I'd change is the YARD doc for that parameter – I'd like the argument type to be Lita::Room instead of String (even though string will technically work) to encourage people to use room objects.

I'd also like to have a test case for this both for documentation of expected behavior and to prevent regressions. Thank you for your work on this!

@nickjer
Copy link
Author

nickjer commented Jun 17, 2015

Hah, sorry, I am an idiot. I completely glossed over that YARD doc parameter.

I also added some basic tests. Let me know if those are enough, or if I should test even more.

jimmycuadra added a commit that referenced this pull request Jun 18, 2015
allow user to send message from a room in tests
@jimmycuadra jimmycuadra merged commit 2b1ef35 into litaio:master Jun 18, 2015
@jimmycuadra
Copy link
Collaborator

Thank you!

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.

2 participants