【文件属性】:
文件名称:fixturama:在RSpec中处理夹具的助手集合
文件大小:28KB
文件格式:ZIP
更新时间:2021-04-01 02:02:02
Ruby
Fixturama
在处理夹具的助手集合
阅读。
安装
gem "fixturama"
配置
在Rails上,向数据库表的ID序列添加偏移量。
# spec/rails_helper.rb
RSpec . configure do | config |
config . before ( :suite ) { Fixturama . start_ids_from 1_000_000 }
end
现在,当您对固定装置中的ID进行硬编码(在1_000_000以下)时,它们将不会与通过合法方式创建的ID发生冲突。
用法
# spec/spec_helper.rb
require "fixturama/rspec"
gem定义了3个助手(支持ERB绑定):
load_fixture(path, **opts)从固定装置加载数据,并反序列化YAML和JSON
seed_fixtur
【文件预览】:
fixturama-master
----.gitignore(114B)
----.rspec(30B)
----.travis.yml(271B)
----fixturama.gemspec(2KB)
----.rubocop.yml(512B)
----CHANGELOG.md(6KB)
----LICENSE.txt(1KB)
----spec()
--------spec_helper.rb(532B)
--------fixturama()
----README.md(7KB)
----lib()
--------fixturama.rb(2KB)
--------fixturama()
----Gemfile(197B)
----Rakefile(114B)