Sha256: 41f851777aea39d8175a1d3ea70edfd88daa7c89f8d1a796941bdf409de432d2

Contents?: true

Size: 623 Bytes

Versions: 3

Compression:

Stored size: 623 Bytes

Contents

require_relative '../test_helper'
DuckPuncher.punch! :Array

class ArrayTest < MiniTest::Test
  attr_reader :subject

  def setup
    @subject = ('a'..'m').to_a
  end

  def test_m
    assert_equal subject.map(&:upcase), subject.m(:upcase)
  end

  def test_mm_with_two_args
    assert_equal subject.map { |x| x.prepend('btn-') }, subject.mm(:prepend, 'btn-')
  end

  def test_mm_with_three_args
    assert_equal subject.map { |x| x.sub(/[aeiou]/, '*') }, subject.mm(:sub, /[aeiou]/, '*')
  end

  def test_get
    assert_equal [].methods.get(/ty\?/), [:empty?]
    assert_equal [].methods.get('ty?'), [:empty?]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
duck_puncher-2.6.0 test/duck_puncher/array_test.rb
duck_puncher-2.5.1 test/duck_puncher/array_test.rb
duck_puncher-2.5.0 test/duck_puncher/array_test.rb