ftp-manager/test/test_helper.rb

41 lines
1.0 KiB
Ruby

# frozen_string_literal: true
ENV['RAILS_ENV'] ||= 'test'
# https://github.com/colszowka/simplecov
require 'simplecov'
SimpleCov.start 'rails' do
add_group 'Models', %w(app/models app/validators)
add_group 'PORO', %w(app/services)
end
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/autorun"
require 'minitest/reporters'
require 'webmock/minitest'
Dir[Rails.root.join("test/test_helpers/**/*.rb")].each { |f| require f }
WebMock.disable_net_connect!(allow_localhost: true)
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(color: true)]
class ActiveSupport::TestCase
ActiveRecord::Migration.maintain_test_schema!
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
@@files_checked = false
def verify_test_files
return if @@files_checked
FileUtils.mkdir_p AppConfig.ftpusers
FileUtils.touch AppConfig.htpasswd
@@files_checked = true
end
def setup
verify_test_files
end
end