Sha256: 01b1e0202119f08924db0d0786052fada4b27e1bbe38b203ea9461212e621870
Contents?: true
Size: 880 Bytes
Versions: 19
Compression:
Stored size: 880 Bytes
Contents
class ActiveSupport::TestCase def Build(*args) # rubocop:disable Style/MethodName n = args.shift if args.first.is_a?(Numeric) factory = args.shift factory_bot_args = args.shift || {} if n [].tap do |collection| n.times.each { collection << FactoryBot.build(factory.to_s.singularize.to_sym, factory_bot_args) } end else FactoryBot.build(factory.to_s.singularize.to_sym, factory_bot_args) end end def Generate(*args) # rubocop:disable Style/MethodName n = args.shift if args.first.is_a?(Numeric) factory = args.shift factory_bot_args = args.shift || {} if n [].tap do |collection| n.times.each { collection << FactoryBot.create(factory.to_s.singularize.to_sym, factory_bot_args) } end else FactoryBot.create(factory.to_s.singularize.to_sym, factory_bot_args) end end end
Version data entries
19 entries across 19 versions & 2 rubygems