Created
March 9, 2019 16:21
-
-
Save igkuz/1ffec2719147713658eeb8044c258b5b to your computer and use it in GitHub Desktop.
Define factories with rom-factory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let(:factories) do | |
ROM::Factory.configure do |config| | |
config.rom = MAIN_CONTAINER | |
end | |
end | |
before do | |
factories.define(:post) do |f| | |
f.url { fake(:internet, :url, 'example.com') } | |
f.se_post false | |
f.stats {} | |
f.association(:company) | |
end | |
factories.define(:company) do |f| | |
f.sequence(:name) {|n| "Company Name #{n}"} | |
f.domain { "https://#{fake(:internet, :domain_name)}" } | |
f.state "running" | |
end | |
factories.define(with_post: :company) do |f| | |
f.association(:posts, count: 1) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment