Sha256: b636fdc673ab7b170cc17e2ed3e927d159ba601d07960eb9f37d4304c6ebd199

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

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

require 'hamster/set'

describe Hamster::Set do

  describe "#join" do

    describe "with a separator" do

      [
        [[], ""],
        [["A"], "A"],
        [[1, 2, 3], "1|2|3"]
      ].each do |values, expected|

        describe "on #{values.inspect}" do

          before do
            original = Hamster.set(*values)
            @result = original.join("|")
          end

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

        end

      end

    end

    describe "without a separator" do

      [
        [[], ""],
        [["A"], "A"],
        [[1, 2, 3], "123"]
      ].each do |values, expected|

        describe "on #{values.inspect}" do

          before do
            original = Hamster.set(*values)
            @result = original.join
          end

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

        end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hamster-0.2.7 spec/hamster/set/join_spec.rb
hamster-0.2.6 spec/hamster/set/join_spec.rb