Sha256: 08fb28189041240776c881a45503912b200a35260ec4629d0955f566d3f3b97e
Contents?: true
Size: 809 Bytes
Versions: 1
Compression:
Stored size: 809 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lopata-0.1.6 | lib/lopata/factory_bot.rb |