针对 Go 的 Ruby on Rails 样式的测试数据,针对真实数据库编写测试
基本上,这个包模仿了 Ruby on Rails 的测试方式,用于数据库应用程序的测试,其中示例数据保存在 fixture 文件中。在执行每个测试之前,测试数据库将被清理,fixture 数据将被加载到数据库中。
文件的格式如下(它可以包含您需要的多个记录):
# comments.yml
- id: 1
post_id: 1
content: A comment...
author_name: John Doe
author_email: [email protected]
created_at: 2020-12-31 23:59:59
updated_at: 2020-12-31 23:59:59
- id: 2
post_id: 2
content: Another comment...
author_name: John Doe
author_email: [email protected]
created_at: 2020-12-31 23:59:59
updated_at: 2020-12-31 23:59:59
# ...暂无开放 Issues,或尚未同步最近议题。