Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

#join now can join multiple channels at a time.

  • Loading branch information...
commit 2f7122fa0fe014eaf311c25c72a94b3095d99026 1 parent da0012f
David Leal authored
Showing with 15 additions and 6 deletions.
  1. +2 −2 lib/minibot/commands.rb
  2. +13 −4 spec/commands_spec.rb
4 lib/minibot/commands.rb
View
@@ -1,7 +1,7 @@
module MiniBot
module Commands
- def join(channel)
- write "JOIN #{channel}"
+ def join(*channels)
+ channels.each { |channel| write "JOIN #{channel}" }
end
private
17 spec/commands_spec.rb
View
@@ -5,9 +5,18 @@ class CommandBot
include MiniBot::Commands
end
- it "should join a channel" do
- bot = CommandBot.new
- bot.should_receive(:write).with("JOIN #testchannel")
- bot.join "#testchannel"
+ describe "#join" do
+ it "should join a channel" do
+ bot = CommandBot.new
+ bot.should_receive(:write).with("JOIN #testchannel")
+ bot.join "#testchannel"
+ end
+
+ it "should join multiple channels" do
+ bot = CommandBot.new
+ bot.should_receive(:write).with("JOIN #testchannel")
+ bot.should_receive(:write).with("JOIN #anotherchannel")
+ bot.join "#testchannel", "#anotherchannel"
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.