2
当我在一个测试类中有很多测试时,我使用Module对测试进行分组。在Test :: Unit中使用模块对测试进行分组
因为我很新的轨道,我的问题是:
是不是正确的方式来组测试或我在做很愚蠢的事情不知道其他的副作用?
下面是代码:
require 'test_helper'
module AttributeValidationTest
extend ActiveSupport::Testing::Declarative
test "should not ...." do
# .....
end
# other tests here....
end
module AnotherGroupTest
extend ActiveSupport::Testing::Declarative
# tests.....
end
# may be another modules..
class MyModelTest < ActiveSupport::TestCase
include AttributeValidationTest
include AnotherGroupTest
end
感谢。