Change from rake Task to a single spec

This has the advantage that if you run the whole suite it gets run
automatically but if you run a single test it doesn't. This seems
like the best of both worlds..
This commit is contained in:
Daniel Schädler 2019-05-13 16:46:13 +02:00
parent a0703c06b8
commit 8e9c61fe5b
2 changed files with 15 additions and 8 deletions

View File

@ -1,8 +0,0 @@
# frozen_string_literal: true
namespace :factorybot do
desc 'Lint FactoryBot factories'
task lint: :environment do
FactoryBot.lint
end
end

View File

@ -0,0 +1,15 @@
# frozen_string_literal: true
# spec/lint_spec.rb
require 'rails_helper'
RSpec.describe 'Lint' do
it 'FactoryBot factories' do
conn = ActiveRecord::Base.connection
conn.transaction do
FactoryBot.lint
raise ActiveRecord::Rollback
end
end
end