論文みたく書くのは苦手なので記述だけ。
def self.__create_dummy_tests
50.times do
Test.create({
company_id: rand(Company.count),
user_id: rand(User.count),
send_at: Random.rand(Time.zone.now.ago(2.month)..Time.zone.now),
form_id: SecureRandom.base64(20),
answered_at: [nil, Random.rand(Time.zone.now.ago(2.month)..Time.zone.now)].sample,
is_active: [true, false].sample
})
end
end