Sha256: 807c6827f1631ad7ae16486f290d862cb72a5833bdac0e41a9d2b30f6d6a67df
Contents?: true
Size: 498 Bytes
Versions: 4
Compression:
Stored size: 498 Bytes
Contents
require "json" module FactoryBurgers module Middleware # Respond with factory data to display in the main form class Data def call(*) factories = FactoryBot.factories.sort_by(&:name) factory_data = factories.map { |factory| factory_data(factory) } return [200, {"Content-Type" => "application/json"}, [JSON.dump(factory_data)]] end def factory_data(factory) FactoryBurgers::Models::Factory.new(factory).to_h end end end end
Version data entries
4 entries across 4 versions & 1 rubygems