Add automatic generation of financial transactions and links

This commit is contained in:
Patrick Gansterer 2017-01-26 13:27:30 +01:00
parent 91eeac6c40
commit 8e2ca5e7d7
11 changed files with 284 additions and 0 deletions

View file

@ -0,0 +1,15 @@
require 'factory_bot'
FactoryBot.define do
factory :bank_account do
name { Faker::Bank.name }
iban { Faker::Bank.iban }
end
factory :bank_transaction do
date { Faker::Date.backward(days: 14) }
text { Faker::Lorem.sentence }
end
end

15
spec/factories/invoice.rb Normal file
View file

@ -0,0 +1,15 @@
require 'factory_bot'
FactoryBot.define do
factory :invoice do
supplier
number { rand(1..99999) }
amount { rand(0.1..26.0).round(2) }
after :create do |invoice|
invoice.supplier.reload
end
end
end