1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
require 'spec_helper'
describe Immutable::Deque do
describe '.[]' do
context 'with no arguments' do
it 'always returns the same instance' do
D[].class.should be(Immutable::Deque)
D[].should equal(D[])
end
it 'returns an empty, frozen deque' do
D[].should be_empty
D[].should be_frozen
end
end
context 'with a number of items' do
let(:deque) { D['A', 'B', 'C'] }
it 'always returns a different instance' do
deque.should_not equal(D['A', 'B', 'C'])
end
it 'is the same as repeatedly using #endeque' do
deque.should eql(D.empty.enqueue('A').enqueue('B').enqueue('C'))
end
end
end
end
|