Sha256: 149a715ce9f2a330853a3540d68d8b753e901a2032a57070d371f9ae39285798

Contents?: true

Size: 771 Bytes

Versions: 1

Compression:

Stored size: 771 Bytes

Contents

require 'abstract_unit'
require 'active_support/core_ext/name_error'

class NameErrorTest < Test::Unit::TestCase
  def test_name_error_should_set_missing_name
    begin
      SomeNameThatNobodyWillUse____Really ? 1 : 0
      flunk "?!?!"
    rescue NameError => exc
      assert_equal "NameErrorTest::SomeNameThatNobodyWillUse____Really", exc.missing_name
      assert exc.missing_name?(:SomeNameThatNobodyWillUse____Really)
      assert exc.missing_name?("NameErrorTest::SomeNameThatNobodyWillUse____Really")
    end
  end

  def test_missing_method_should_ignore_missing_name
    begin
      some_method_that_does_not_exist
      flunk "?!?!"
    rescue NameError => exc
      assert_equal nil, exc.missing_name
      assert ! exc.missing_name?(:Foo)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
recliner-0.0.1 vendor/activesupport/test/core_ext/name_error_test.rb