不要受单元测试的教条所限。
如果为数据库支撑使用了ActiveRecord,则很可能会用受数据库支撑的测试进行所有的单元测试。
If you're using ActiveRecord for your database backing, you will likely do all of your unit tests with database-backed testing.
这种方法的一个有趣的副作用是允许通过闭包访问类的私有成员和受保护成员,这有利于对类执行单元测试。
One interesting side effect of this approach is that it allows us to access private and protected members of a class via a closure, which can be handy for unit testing classes.
这种方法的一个有趣的副作用是允许通过闭包访问类的私有成员和受保护成员,这有利于对类执行单元测试。
One interesting side effect of this approach is that it allows us to access private and protected members of a class via a closure, which can be handy for unit testing classes.
应用推荐