Sha256: aa177acaa907c7f98c7c1b29ce31b83e459fd5e2025a57e2d6764ae02a22711f

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

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

require 'hamster/set'

describe Hamster::Set do

  [:minimum, :min].each do |method|

    describe "##{method}" do

      describe "with a block" do

        [
          [[], nil],
          [["A"], "A"],
          [["Ichi", "Ni", "San"], "Ni"],
        ].each do |values, expected|

          describe "on #{values.inspect}" do

            before do
              original = Hamster.set(*values)
              pending do
                @result = original.send(method) { |maximum, item| item.length <=> maximum.length }
              end
            end

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

          end

        end

      end

      describe "without a block" do

        [
          [[], nil],
          [["A"], "A"],
          [["Ichi", "Ni", "San"], "Ichi"],
        ].each do |values, expected|

          describe "on #{values.inspect}" do

            before do
              original = Hamster.set(*values)
              pending do
                @result = original.send(method)
              end
            end

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

          end

        end

      end

    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hamster-0.2.5 spec/hamster/set/minimum_spec.rb
hamster-0.2.4 spec/hamster/set/minimum_spec.rb
hamster-0.2.3 spec/hamster/set/minimum_spec.rb
hamster-0.2.2 spec/hamster/set/minimum_spec.rb
hamster-0.2.1 spec/hamster/set/minimum_spec.rb
hamster-0.2.0 spec/hamster/set/minimum_spec.rb
hamster-0.1.23 spec/hamster/set/minimum_spec.rb
hamster-0.1.22 spec/hamster/set/minimum_spec.rb