Sha256: 863106509d8e3228aa07800fc05559dab5c7412b37bf283fee8251db07deaf1c

Contents?: true

Size: 913 Bytes

Versions: 3

Compression:

Stored size: 913 Bytes

Contents

require 'spec_helper'

describe MadChatter::MessageListeners::Code 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::Code.new }
  
  before(:each) do
    MadChatter.users = []
    MadChatter.channels = []
  end
  
  it 'should set html correctly' do
    MadChatter.users << user
    MadChatter.channels << channel
    begin
      message_text = <<-EOS
/code <?php
    echo "multiline";
    echo "code sample";
?>
EOS
      message = MadChatter::Message.new('message', message_text, user.token, channel.id)
      listener.handle(message)
      message.html.should == <<-EOS
<pre><?php
    echo "multiline";
    echo "code sample";
?></pre>
EOS
    rescue RuntimeError
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mad_chatter-0.3.4 spec/message_listeners/code_spec.rb
mad_chatter-0.3.3 spec/message_listeners/code_spec.rb
mad_chatter-0.3.2 spec/message_listeners/code_spec.rb