Sha256: 5f25b565720792fab24bfbb6310e001faa2cf1bb77fa5074be09b8a50be4cc62

Contents?: true

Size: 763 Bytes

Versions: 5

Compression:

Stored size: 763 Bytes

Contents

require 'spec_helper'

describe MadChatter::MessageHistory do

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mad_chatter-0.3.4 spec/message_history_spec.rb
mad_chatter-0.3.3 spec/message_history_spec.rb
mad_chatter-0.3.2 spec/message_history_spec.rb
mad_chatter-0.3.1 spec/message_history_spec.rb
mad_chatter-0.3.0 spec/message_history_spec.rb