Chatwoot/spec/cypress/cypress_helper.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

33 lines
722 B
Ruby

# This is loaded once before the first command is executed
begin
require 'database_cleaner'
rescue LoadError => e
puts e.message
end
begin
require 'factory_bot_rails'
rescue LoadError => e
puts e.message
begin
require 'factory_girl_rails'
rescue LoadError => e
puts e.message
end
end
require 'cypress_on_rails/smart_factory_wrapper'
factory = CypressOnRails::SimpleRailsFactory
factory = FactoryBot if defined?(FactoryBot)
factory = FactoryGirl if defined?(FactoryGirl)
CypressOnRails::SmartFactoryWrapper.configure(
always_reload: !Rails.configuration.cache_classes,
factory: factory,
files: [
Rails.root.join('spec/factories.rb'),
Rails.root.join('spec/factories/**/*.rb')
]
)