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

Commit

Permalink
Add #join and #part.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmycuadra committed Feb 23, 2014
1 parent 7d36d91 commit d53e6b5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/lita/adapters/irc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ def run
cinch.start
end

def join(room_id)
cinch.join(room_id)
end

def part(room_id)
cinch.part(room_id)
end

def send_messages(target, strings)
if target.private_message?
user = Cinch::User.new(target.user.name, cinch)
Expand Down
14 changes: 14 additions & 0 deletions spec/lita/adapters/irc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@
expect(subject.cinch.loggers).not_to be_empty
end

describe "#join" do
it "joins a channel" do
expect(subject.cinch).to receive(:join).with("#lita.io")
subject.join("#lita.io")
end
end

describe "#part" do
it "parts from a channel" do
expect(subject.cinch).to receive(:part).with("#lita.io")
subject.part("#lita.io")
end
end

describe "#run" do
it "connects to IRC" do
expect(subject.cinch).to receive(:start)
Expand Down

0 comments on commit d53e6b5

Please sign in to comment.