I’m slowly making my way through the rails source, to get a better grip on ruby and rails in general. In the following rails class test_case.rb
the line is
class TestCase < ::Test::Unit::TestCase
and I was wondering if there is any difference with doing the following
class TestCase < Test::Unit::TestCase
It may seem trivial, but these things matter picking up a new language. The tests still run for ActiveSupport if I remove the leading :: so what does it do… 😛
::Testensures that you get a toplevel module named Test.The latter case (
Test::Unit::TestCase) doesn’t ensure that Test is a toplevel module, it could be a class, for example. It means that most of the time, it’ll work, but you could accidentally break it.