Sha256: e752e19331d6f022965d32cc8e725e66c5f2a6da8d56b5eafbfa3968919eb56e

Contents?: true

Size: 547 Bytes

Versions: 17

Compression:

Stored size: 547 Bytes

Contents

# encoding: utf-8

class Nanoc::ExtraCoreExtEnumerableTest < MiniTest::Unit::TestCase

  include Nanoc::TestHelpers

  class MyCollection

    include Enumerable

    def initialize(array)
      @array = array
    end

    def each(&block)
      @array.each { |i| block.call(i) }
    end

  end

  def test_group_by
    input = MyCollection.new([ 'foo', 'bar', 'baz' ])

    output_expected = { ?f => [ 'foo' ], ?b => [ 'bar', 'baz' ] }
    output_actual   = input.group_by { |i| i[0] }

    assert_equal output_expected, output_actual
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
nanoc-3.6.1 test/extra/core_ext/test_enumerable.rb
nanoc-3.6.0 test/extra/core_ext/test_enumerable.rb
nanoc-3.5.0 test/extra/core_ext/test_enumerable.rb
nanoc-3.5.0b2 test/extra/core_ext/test_enumerable.rb
nanoc-3.5.0b1 test/extra/core_ext/test_enumerable.rb
nanoc-3.4.3 test/extra/core_ext/test_enumerable.rb
nanoc-3.4.2 test/extra/core_ext/test_enumerable.rb
nanoc-3.4.1 test/extra/core_ext/test_enumerable.rb
nanoc-3.4.0 test/extra/core_ext/test_enumerable.rb
nanoc-3.3.7 test/extra/core_ext/test_enumerable.rb
nanoc-3.3.6 test/extra/core_ext/test_enumerable.rb
nanoc-3.3.5 test/extra/core_ext/test_enumerable.rb
nanoc-3.3.4 test/extra/core_ext/test_enumerable.rb
nanoc-3.3.3 test/extra/core_ext/test_enumerable.rb
nanoc-3.3.2 test/extra/core_ext/test_enumerable.rb
nanoc-3.3.1 test/extra/core_ext/test_enumerable.rb
nanoc-3.3.0 test/extra/core_ext/test_enumerable.rb