Chatwoot/spec/cypress/app_commands/factory_bot.rb
Sojan Jose d6f309ce22
Chore: Initialize Cypress tests (#1078)
Addresses: #412

Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
2020-07-21 20:11:22 +05:30

12 lines
466 B
Ruby

Array.wrap(command_options).map do |factory_options|
factory_method = factory_options.shift
begin
logger.debug "running #{factory_method}, #{factory_options}"
CypressOnRails::SmartFactoryWrapper.public_send(factory_method, *factory_options)
rescue StandardError => e
logger.error "#{e.class}: #{e.message}"
logger.error e.backtrace.join("\n")
logger.error e.record.inspect.to_s if e.is_a?(ActiveRecord::RecordInvalid)
raise e
end
end