Sha256: c5f3531588e9c54c4dcc58298545d6ee456d83dfcd476f81c6f219b73c845ce3

Contents?: true

Size: 777 Bytes

Versions: 4

Compression:

Stored size: 777 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

require 'hamster/tuple'

describe Hamster::Tuple do

  describe "#to_a" do

    [
      [],
      ["A"],
      ["A", "B", "C"],
    ].each do |values|

      describe "on #{values.inspect}" do

        before do
          @tuple = Hamster::Tuple.new(*values)
          @result = @tuple.to_a
        end

        it "returns #{values.inspect}" do
          @result.should == values
        end

        it "works with splat" do
          array = *@tuple
          array.should == values
        end

        it "returns a mutable array" do
          @result.last.should_not == "The End"
          @result << "The End"
          @result.last.should == "The End"
        end

      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hamster-0.2.5 spec/hamster/tuple/to_a_spec.rb
hamster-0.2.4 spec/hamster/tuple/to_a_spec.rb
hamster-0.2.3 spec/hamster/tuple/to_a_spec.rb
hamster-0.2.2 spec/hamster/tuple/to_a_spec.rb