Sha256: cedb7384de08b780dae29e10ce3f3c1ef051d7aec13ca197f421f4cf3301b10b

Contents?: true

Size: 792 Bytes

Versions: 3

Compression:

Stored size: 792 Bytes

Contents

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

require 'hamster/set'

describe Hamster::Set do

  describe "#to_list" do

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

      describe "on #{values.inspect}" do

        before do
          set = Hamster.set(*values)
          @list = set.to_list
        end

        it "returns a list" do
          @list.is_a?(Hamster::List).should be_true
        end

        describe "the returned list" do

          it "has the correct length" do
            @list.size.should == values.size
          end

          it "contains all values" do
            values.each do |value|
              @list.should include(value)
            end
          end

        end

      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hamster-0.1.19 spec/hamster/set/to_list.rb
hamster-0.1.18 spec/hamster/set/to_list.rb
hamster-0.1.17 spec/hamster/set/to_list.rb