# encoding: utf-8 require "securerandom" FactoryGirl.define do chars = ("A".."Z").to_a factory :unit, class: Okei::Unit do uuid { SecureRandom.uuid } sequence(:name) { |n| "Единица #{ n }" } sequence(:code) { |n| "ЕИ #{ n }" } sequence(:num) { |n| format "%03d", (n + 1) % 999 } sequence(:int_code) { |n| chars[n % 25] + chars[n % 24] + chars[n % 23] } base { "М" } factor { rand(0.01..1000.0).round(2) } measure { "Длина" } end end