Sha256: 000d161aef24974fdaf970f356cf5259ed4698e5aa3eddf80436fa6bfaafcf43

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

require 'spec_helper'

describe MadChatter::MessageHistory do

  before(:each) do
    MadChatter::MessageHistory.clear
  end
  
  it 'should only keep 10 recent messages' do
    15.times do
      MadChatter::MessageHistory.add MadChatter::Message.new('message', 'Here is a dummy chat message')
    end
    MadChatter::MessageHistory.all.length.should == 10
  end

  it 'should allow you to clear the history' do
    MadChatter::MessageHistory.add MadChatter::Message.new('message', 'Here is a dummy chat message')
    MadChatter::MessageHistory.all.length.should == 1
    MadChatter::MessageHistory.clear
    MadChatter::MessageHistory.all.length.should == 0
  end
  
  context '#all' do
    it 'should still return an empty array if there is message chat history' do
      history = MadChatter::MessageHistory.all
      history.should == []
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mad_chatter-0.2.9 spec/message_history_spec.rb
mad_chatter-0.2.8 spec/message_history_spec.rb