Sha256: 5208c3ddee0f50be9a74e5c50d743fc0e4f46d0c54962b1b95668fce52d8c56c
Contents?: true
Size: 840 Bytes
Versions: 4
Compression:
Stored size: 840 Bytes
Contents
require_relative 'active_record' module Lopata module FactoryBot # To be included in Lopata::Scenario module Methods def create(*params) cleanup_later ::FactoryBot.create(*params) end def find_created(cls, params) cleanup_later cls.where(params).take end def cleanup_later(object) return nil unless object @created_objects ||= [] @created_objects << object object end end # To be included in Lopata::ScenarioBuilder module DSL end end end Lopata::Scenario.include Lopata::FactoryBot::Methods Lopata::ScenarioBuilder.include Lopata::FactoryBot::DSL Lopata.configure do |c| c.after_scenario { cleanup @created_objects } end ::FactoryBot.find_definitions unless Lopata::Config.readonly
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
lopata-0.1.5 | lib/lopata/factory_bot.rb |
lopata-0.1.4 | lib/lopata/factory_bot.rb |
lopata-0.1.3 | lib/lopata/factory_bot.rb |
lopata-0.1.2 | lib/lopata/factory_bot.rb |