log.rb 452 B

1234567891011121314
  1. FactoryBot.define do
  2. factory :'cti/log', aliases: %i[cti_log] do
  3. direction { %w[in out].sample }
  4. state { 'newCall' }
  5. from { '4930609854180' }
  6. to { '4930609811111' }
  7. call_id { (Cti::Log.pluck(:call_id).map(&:to_i).max || 0).next } # has SQL UNIQUE constraint
  8. done { false }
  9. trait :with_preferences do
  10. preferences { Cti::CallerId.get_comment_preferences(from, 'from')&.last }
  11. end
  12. end
  13. end