Sha256: d41ac1d66358a48badd6ba95b782357e1deb53f6204fe77a0ac0971495feb928
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require_relative '../spec_helper' describe MadChatter::MessageListeners::Join do let (:server) { MadChatter::Server.new({'websocket_backend' => 'MadChatter::Servers::EventMachineWebSocket'}) } let (:user) { MadChatter::User.new('usertoken') } let (:channel) { MadChatter::Channel.new('myroom') } let (:listener) { MadChatter::MessageListeners::Join.new } before(:each) do MadChatter.users = [] MadChatter.channels = [] end it 'should add user to list of users in server and channel' do MadChatter.users << user MadChatter.channels << channel begin MadChatter.users.include?(user).should be_true MadChatter.find_channel_by_name('myroom').users.include?(user).should be_false message = MadChatter::Message.new('message', '/join', user.token, channel.id) listener.handle(message) MadChatter.find_channel_by_name('myroom').users.include?(user).should be_true rescue RuntimeError end end it 'should parse messages correctly' do message = MadChatter::Message.new('message', 'this /join should not count') listener.handle(message) # how to check that nothing happened? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mad_chatter-0.3.1 | spec/message_listeners/join_spec.rb |
mad_chatter-0.3.0 | spec/message_listeners/join_spec.rb |