# frozen_string_literal: true

# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
require 'simplecov'

require 'cucumber/rails'
require 'billy/capybara/cucumber'
require 'cucumber/rspec/doubles'
require 'webmock/cucumber'
require 'capybara-screenshot/cucumber'

ActionController::Base.allow_rescue = false

# Remove/comment out the lines below if your app doesn't have a database.
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
# begin
#  DatabaseCleaner.strategy = :transaction
# rescue NameError
#  raise 'You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it.'
# end

# Cucumber::Rails::Database.javascript_strategy = :truncation

Before do
  Settings.reload!
  StaticPage.create!(title: 'getting started', body: 'remote pair programming')
end

# To be used in conjunction with rerun option, so that we don't return a failing
# exit code until the second try fails
at_exit do
  exit 0 if ENV['NEVER_FAIL'] == 'true'
end

# Simplify FactoryBot methods in step definitions
World(FactoryBot::Syntax::Methods)
