Merge pull request #2844 from hennevogel/refactoring/factory-linting

Validate factories exactly once
This commit is contained in:
Henne Vogelsang 2021-08-18 15:36:23 +02:00 committed by GitHub
commit 95609358ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 5 additions and 136 deletions

View file

@ -1,17 +1,14 @@
# frozen_string_literal: true
namespace :factory_bot do
desc "Verify that all FactoryBot factories are valid"
task lint: :environment do
if Rails.env.test?
begin
DatabaseCleaner.start
conn = ActiveRecord::Base.connection
conn.transaction do
FactoryBot.lint
ensure
DatabaseCleaner.clean
raise ActiveRecord::Rollback
end
else
system("bundle exec rake factory_bot:lint RAILS_ENV='test'")
raise "\nERROR: You should not run this outside the test environment...\n\n"
end
end
end

View file

@ -28,7 +28,6 @@ namespace :data do
dot_env.puts "OSEM_ICHAIN_ENABLED=\"#{CONFIG['authentication']['ichain']['enabled']}\"" if CONFIG.has_key?(:authentication)
dot_env.puts "OSEM_TRANSIFEX_APIKEY=\"#{CONFIG['transifex_live_api_key']}\""
dot_env.puts "OSEM_ERRBIT_HOST=\"#{CONFIG['errbit_host']}\""
dot_env.puts "OSEM_FACTORY_LINT=\"#{CONFIG['factory_bot_lint']}\""
dot_env.puts "OSEM_SMTP_ADDRESS=\"#{CONFIG['mail_address']}\""
dot_env.puts "OSEM_SMTP_PORT=\"#{CONFIG['mail_port']}\""
dot_env.puts "OSEM_SMTP_USERNAME=\"#{CONFIG['mail_username']}\""