Sha256: 3322313685d16cd2b36cf6f2d2ef475b6f911feebd564fde161bb6324f695fe4

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

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

describe Array do
  context '* operator' do
    it 'call the same method on each item in an array and return the results as an array' do
      expect(['some', 'short', 'words'].*.length).to eq([4, 5, 5])
    end

    it 'handle methods with arguments' do
      expect(['some', 'short', 'words'].*.slice(1, 2)).to eq(['om', 'ho', 'or'])
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
invoca-utils-0.6.0 spec/unit/array_spec.rb
invoca-utils-0.5.1 spec/unit/array_spec.rb
invoca-utils-0.5.0 spec/unit/array_spec.rb