Sha256: 69cd5620897e4128ec6862e747fefd724ba743d50715679966e160d2684f8309

Contents?: true

Size: 646 Bytes

Versions: 6

Compression:

Stored size: 646 Bytes

Contents

require_relative '../../test_helper'

DuckPuncher.punch! :Object

class ArrayTest < MiniTest::Test
  attr_reader :subject

  def setup
    @subject = ('a'..'m').to_a.punch
  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.punch.get(/ty\?/), [:empty?]
    assert_equal [].methods.punch.get('ty?'), [:empty?]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
duck_puncher-2.12.1 test/lib/duck_puncher/array_test.rb
duck_puncher-2.12.0 test/lib/duck_puncher/array_test.rb
duck_puncher-2.11.0 test/lib/duck_puncher/array_test.rb
duck_puncher-2.10.2 test/lib/duck_puncher/array_test.rb
duck_puncher-2.10.1 test/lib/duck_puncher/array_test.rb
duck_puncher-2.10.0 test/lib/duck_puncher/array_test.rb