Sha256: 6f1a4990b327496d04a109ca42dddad9e81c58863fd3dcade7311b88505deab3

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'test_helper')
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'core_ext', 'object')

class ObjectTest < Test::Unit::TestCase

  def test_try_call_on_existing
    assert_equal('abc', 'abc'.try_call.to_s)
  end
  
  def test_try_call_on_not_existing
    assert_nothing_raised do
      assert_equal(nil, 'abc'.try_call.foo)
    end
  end
  
  def test_try_call_on_existing_alternative
    assert_equal('abc', 'abc'.try_call(:to_s))
  end
  
  def test_try_call_on_not_existing_alternative
    assert_nothing_raised do
      assert_equal(nil, 'abc'.try_call(:foo))
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
talia_core-0.7.0 test/core_ext/object_test.rb