File: pop_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 (25 lines) | stat: -rw-r--r-- 465 bytes parent folder | download
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
require 'spec_helper'

describe Immutable::List do
  let(:list) { L[*values] }

  describe '#pop' do
    let(:pop) { list.pop }

    context 'with an empty list' do
      let(:values) { [] }

      it 'returns an empty list' do
        expect(pop).to eq(L.empty)
      end
    end

    context 'with a list with a few items' do
      let(:values) { %w[a b c] }

      it 'removes the last item' do
        expect(pop).to eq(L['a', 'b'])
      end
    end
  end
end