Sha256: 640048bf522e59173514633906b9fc238421319e45e7cfdd20013b27b2211a0e

Contents?: true

Size: 717 Bytes

Versions: 5

Compression:

Stored size: 717 Bytes

Contents

# frozen_string_literal: true

require_relative '../../lib/invoca/utils/array.rb'
require_relative '../test_helper'

class ArrayTest < Minitest::Test
  context '* operator' do
    should 'call the same method on each item in an array and return the results as an array' do
      assert_equal([4, 5, 5], ['some', 'short', 'words'].*.length)
    end

    should 'handle methods with arguments' do
      assert_equal(['om', 'ho', 'or'], ['some', 'short', 'words'].*.slice(1, 2))
    end

    should 'not alter normal behavior (multiplication) when there is a right hand side to the expression' do
      assert_equal(['some', 'short', 'words', 'some', 'short', 'words'], ['some', 'short', 'words'] * 2)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
invoca-utils-0.4.1 test/unit/array_test.rb
invoca-utils-0.4.0 test/unit/array_test.rb
invoca-utils-0.3.0 test/unit/array_test.rb
invoca-utils-0.2.0 test/unit/array_test.rb
invoca-utils-0.2.0.pre.1 test/unit/array_test.rb