您的位置:首页 > 大数据 > 人工智能

Rails测试中清空数据表/载入空fixtures

2008-10-03 12:50 309 查看
使用spec框架测试,其他测试框架雷同

创建spec/test/empty,其中放入空的yml夹具文件

Fixtures.reset_cache
f = Fixtures.create_fixtures(File.join(RAILS_ROOT,"spec/fixtures/empty"),"teachers")
Teacher.latest_index.should == ""
f.delete_existing_fixtures
Fixtures.reset_cache
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: