File: to_list_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 (30 lines) | stat: -rw-r--r-- 634 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
26
27
28
29
30
require 'spec_helper'

describe Immutable::Vector do
  describe '#to_list' do
    [
      [],
      ['A'],
      %w[A B C],
    ].each do |values|
      describe "on #{values.inspect}" do
        let(:vector) { V.new(values) }
        let(:list) { vector.to_list }

        it 'returns a list' do
          list.is_a?(Immutable::List).should == true
        end

        describe 'the returned list' do
          it 'has the correct length' do
            list.size.should == values.size
          end

          it 'contains all values' do
            list.to_a.should == values
          end
        end
      end
    end
  end
end