mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Move FactoryGirl.lint to rake task
This significantly improves start time of tests. It is also the recommended way: https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#linting-factories Read more at: https://github.com/thoughtbot/factory_girl/issues/772
This commit is contained in:
parent
a8b270f6e1
commit
f84150362b
2 changed files with 15 additions and 7 deletions
15
lib/tasks/factory_girl.rake
Normal file
15
lib/tasks/factory_girl.rake
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
namespace :factory_girl do
|
||||||
|
desc "Verify that all FactoryGirl factories are valid"
|
||||||
|
task lint: :environment do
|
||||||
|
if Rails.env.test?
|
||||||
|
begin
|
||||||
|
DatabaseCleaner.start
|
||||||
|
FactoryGirl.lint
|
||||||
|
ensure
|
||||||
|
DatabaseCleaner.clean
|
||||||
|
end
|
||||||
|
else
|
||||||
|
system("bundle exec rake factory_girl:lint RAILS_ENV='test'")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
RSpec.configure do |config|
|
|
||||||
|
|
||||||
config.before(:suite) do
|
|
||||||
FactoryGirl.lint
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue