Sha256: 78da1503b5c7be779af67c019502e23da92d800c62a7e27ea80d58d36b4c347f

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper' 

module ArubaDoubles
  describe History do
    before do
      PStore.stub(:new)
      @history = History.new('history.pstore')
    end

    #TODO: Add examples to test the transactional stuff with PStore!

    it 'should initialize a PStore with the filename' do
      PStore.should_receive(:new).with('history.pstore')
      History.new('history.pstore')
    end

    describe '#to_s' do
      it 'should return an inspection of the entries' do
        @history.stub_chain(:to_a, :inspect).and_return('entries')
        @history.to_s.should eql('entries')
      end
    end

    describe '#to_pretty' do
      it 'should return a pretty representation to the entries' do
        entries = []
        entries << ['foo']
        entries << ['foo', '--bar']
        entries << ['foo', '--bar', 'hello, world.']
        @history.stub(:to_a).and_return(entries)
        @history.to_pretty.should include('1  foo')
        @history.to_pretty.should include('2  foo --bar')
        @history.to_pretty.should include('3  foo --bar hello,\ world.')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aruba-doubles-1.2.1 spec/aruba-doubles/history_spec.rb