From a88f94ba3ad7c9196e32aa3624d9ac4c4c1776fb Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Mon, 14 Sep 2015 16:50:47 +0200 Subject: [PATCH] improve seeds for the users and add clients --- lib/tasks/devseed.rake | 7 ++++++- spec/factories/transactions.rb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/tasks/devseed.rake b/lib/tasks/devseed.rake index 041998f..6708eeb 100644 --- a/lib/tasks/devseed.rake +++ b/lib/tasks/devseed.rake @@ -5,7 +5,12 @@ unless Rails.env.production? users = FactoryGirl.create_list(:user, 20) 100.times do sample_users = users.sample(2) - FactoryGirl.create :transaction, debtor: sample_users[0], creditor: sample_users[1], amount: 1 + rand(100) + FactoryGirl.create :transaction, debtor: sample_users[0], creditor: sample_users[1] + end + clients = FactoryGirl.create_list(:client, 5) + 100.times do + debtor, creditor = users.sample(2) + FactoryGirl.create :client_transaction, issuer: clients.sample, debtor: debtor, creditor: creditor end end end diff --git a/spec/factories/transactions.rb b/spec/factories/transactions.rb index 237b789..23de4b8 100644 --- a/spec/factories/transactions.rb +++ b/spec/factories/transactions.rb @@ -19,7 +19,7 @@ FactoryGirl.define do association :debtor, factory: :user association :creditor, factory: :user issuer { debtor } - amount { 1 + rand(100) } + amount { 1 + rand(10000) } message { Faker::Lorem.sentence } factory :client_transaction do association :issuer, factory: :client