Skip to content

Instantly share code, notes, and snippets.

# frozen_string_literal: true
module FactoryBot
module Syntax
module Default
class DSL
def spira_factory(name, options = {}, &block)
factory(name, options) do
instance_eval do
initialize_with do
@adelahayepm
adelahayepm / _dry_struct_factory_bot_helper.rb
Created April 14, 2021 08:53
Factory Bot helper to create a Dry::Struct with the factory DSL
# frozen_string_literal: true
module FactoryBot
module Syntax
module Default
class DSL
def dry_struct_factory(name, options = {}, &block)
factory(name, options) do
instance_eval do
initialize_with { new(attributes) }
@adelahayepm
adelahayepm / Gemfile
Last active April 8, 2021 07:18
Benchmark HTTParty vs HTTP.rb with sample API fetching
source 'https://rubygems.org'
gem 'httparty'
gem 'http'