Sha256: 3f5bdf267074f166a5704cd1ecb0078eae04d66947932b91d0288de51edbfc6d

Contents?: true

Size: 871 Bytes

Versions: 3

Compression:

Stored size: 871 Bytes

Contents

require "spec_helper"
require "hamster/set"

describe Hamster::Set do
  describe "#min" do
    context "with a block" do
      [
        [[], nil],
        [["A"], "A"],
        [%w[Ichi Ni San], "Ni"],
      ].each do |values, expected|
        describe "on #{values.inspect}" do
          let(:set) { S[*values] }
          let(:result) { set.min { |minimum, item| minimum.length <=> item.length }}

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

    context "without a block" do
      [
        [[], nil],
        [["A"], "A"],
        [%w[Ichi Ni San], "Ichi"],
      ].each do |values, expected|
        describe "on #{values.inspect}" do
          it "returns #{expected.inspect}" do
            S[*values].min.should == expected
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/hamster-3.0.0/spec/lib/hamster/set/minimum_spec.rb
hamster-3.0.0 spec/lib/hamster/set/minimum_spec.rb
hamster-2.0.0 spec/lib/hamster/set/minimum_spec.rb