Skip to content

Instantly share code, notes, and snippets.

@vangberg
Created June 17, 2010 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vangberg/441924 to your computer and use it in GitHub Desktop.
Save vangberg/441924 to your computer and use it in GitHub Desktop.
require "test/unit"
k = Class.new do
SomeConstant = 123
end
class TestConstant < Test::Unit::TestCase
def test_constant
if RUBY_VERSION >= "1.9"
assert_raises(NameError) {::SomeConstant}
else
assert ::SomeConstant
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment