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:
parent
a0703c06b8
commit
8e9c61fe5b
|
|
@ -1,8 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
namespace :factorybot do
|
|
||||||
desc 'Lint FactoryBot factories'
|
|
||||||
task lint: :environment do
|
|
||||||
FactoryBot.lint
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -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
|
||||||
Loading…
Reference in New Issue