Sha256: 30d31ee52a214cd046d59cfa0178c25fab5dcda3b8952668e0aa2cdfdd8c6a89

Contents?: true

Size: 898 Bytes

Versions: 16

Compression:

Stored size: 898 Bytes

Contents

require_relative '../test_helper'

class DuckPuncherTest < MiniTest::Test
  DuckString = DuckPuncher.punch :String
  DuckNumber, DuckArray = DuckPuncher.punch :Numeric, :Array

  def test_duck_string
    refute_respond_to '', :underscore
    assert_respond_to DuckString.new, :underscore
    refute_respond_to '', :underscore
  end

  def test_duck_number_array
    refute_respond_to 25, :to_currency
    refute_respond_to [], :m
    assert_respond_to DuckNumber.new, :to_currency
    assert_respond_to DuckArray.new, :m
    refute_respond_to 25, :to_currency
    refute_respond_to [], :m
  end

  def test_excluding_punches
    refute_respond_to Object.new, :punch
    DuckPuncher.punch! :Object, only: :punch
    assert_respond_to Object.new, :punch
    refute_respond_to Object.new, :require!
    DuckPuncher.punch! :Object, only: :require!
    assert_respond_to Object.new, :require!
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
duck_puncher-3.0.0 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.16.0 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.15.0 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.14.1 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.14.0 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.13.0 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.12.1 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.12.0 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.11.0 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.10.2 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.10.1 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.10.0 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.9.3 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.9.2 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.9.1 test/soft_punch/duck_puncher_test.rb
duck_puncher-2.9.0 test/soft_punch/duck_puncher_test.rb