File: to_a_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 (26 lines) | stat: -rw-r--r-- 621 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
require 'spec_helper'

describe Immutable::Deque do
  [:to_a, :entries].each do |method|
    describe "##{method}" do
      [
        [],
        ['A'],
        %w[A B C],
      ].each do |values|
        context "on #{values.inspect}" do
          it "returns #{values.inspect}" do
            D[*values].send(method).should == values
          end

          it 'returns a mutable array' do
            result = D[*values].send(method)
            expect(result.last).to_not eq('The End')
            result << 'The End'
            result.last.should == 'The End'
          end
        end
      end
    end
  end
end