Skip to content

Commit

Permalink
Merge pull request #16 from anoldguy/add-sounds
Browse files Browse the repository at this point in the history
Hook up '/play <foo>' to the Tinder::Room#play method so Lita can make music
  • Loading branch information
josacar committed Oct 10, 2014
2 parents 1d76d0e + 194832c commit c38e2ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/lita/adapters/campfire/connector.rb
Expand Up @@ -38,6 +38,8 @@ def send_messages(room_id, messages)
messages.each do |message|
if message.include?("\n")
my_room.paste message
elsif message.start_with?("/play ")
my_room.play message.sub("/play ", "")
else
my_room.speak message
end
Expand Down
9 changes: 9 additions & 0 deletions spec/lita/adapters/campfire/connector_spec.rb
Expand Up @@ -106,6 +106,15 @@
subject.send_messages room, [ message ]
end
end

context 'with a sound' do
let(:message) { "/play yeah" }

it 'plays a sound into room' do
expect(room).to receive(:play).with(message.sub("/play ",""))
subject.send_messages room, [ message ]
end
end
end

describe '#set_topic' do
Expand Down

0 comments on commit c38e2ce

Please sign in to comment.