Rails disposable gem:给 ActiveRecord 提供一个 Twin model

chenge · June 28, 2015 · 1115 hits

disposable gem 是一个新发现,作者的思路是给 ActiveRecord 提供一个 Twin model,这样与数据库隔离开,方便测试什么的。

代码例子

使用方法比较简单,不过我 sync 没实验成功。,经过咨询作者,文档小错误,需要如下处理下:

#in twin model
include  Sync

补充:用于测试似乎效果并不明显,与直接连数据库测试差不多。

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.