File: ltlt_spec.rb

package info (click to toggle)
ruby-immutable-ruby 0.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,852 kB
  • sloc: ruby: 16,556; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 439 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'spec_helper'

describe Immutable::List do
  describe '#<<' do
    it 'adds an item onto the end of a list' do
      list = L['a', 'b']
      (list << 'c').should eql(L['a', 'b', 'c'])
      list.should eql(L['a', 'b'])
    end

    context 'on an empty list' do
      it 'returns a list with one item' do
        list = L.empty
        (list << 'c').should eql(L['c'])
        list.should eql(L.empty)
      end
    end
  end
end