Sha256: 492295518975e41cba233565ee15f5b0304fb24cf8faec80b257462b1f85dd81

Contents?: true

Size: 755 Bytes

Versions: 3

Compression:

Stored size: 755 Bytes

Contents

require 'spec_helper' # see http://stackoverflow.com/q/5061179/314318

describe MadChatter::Message do
  let (:message) { MadChatter::Message.new('joy', 'I am the model of the modern major general') }

  it 'should have a well-known interface' do
    [:text, :to_json, :filter].each do |m|
      message.should respond_to(m)
    end
  end

  it 'should encode into JSON correctly' do
    message.to_json.should match /modern major general/
  end

  context '#filter' do
    it 'should remove <p> tags' do
      message.filter.should_not match /<[\s\\]*p[\s]*>/
    end
    
    it 'should be able to handle messages made of empty space' do
      message = MadChatter::Message.new('message', "    ")
      message.filter.should match ''
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mad_chatter-0.2.8 spec/message_spec.rb
mad_chatter-0.2.7 spec/message_spec.rb
mad_chatter-0.2.6 spec/message_spec.rb