如何编写测试来验证类或模块中是否存在常量?
例子:
module MyModule
  VERSION = "0.3.1"
end
我试过了
require 'test/unit'
require 'shoulda'
require "my_class"
class MyModuleTest < Test::Unit::TestCase
  should "have a Version constant" do
    # next two lines crash
    assert_respond_to MyModule, :VERSION
    assert_respond_to 'VERSION', MyModule
  end
end