From 640be7497fe1e5bba72d4609a7644ae4a9c161b8 Mon Sep 17 00:00:00 2001 From: Aditya Prakash Date: Sat, 20 Feb 2016 13:36:40 +0530 Subject: [PATCH] Add config to allow running FactoryGirl lint before suit By default the lint will be run before every test suit. Set it to false in config.yml if you would rather just use the rake task: `bundle exec rake factory_girl:lint` --- config/config.yml.example | 4 ++++ spec/support/factory_girl.rb | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 spec/support/factory_girl.rb diff --git a/config/config.yml.example b/config/config.yml.example index 86500145..226cc4b5 100644 --- a/config/config.yml.example +++ b/config/config.yml.example @@ -15,6 +15,10 @@ defaults: &defaults ichain: enabled: false + # Set it to false if you don't want FactoryGirl lint to run before every test suit. + # You can run lint manually with: bundle exec rake factory_girl:lint + factory_girl_lint: true + development: <<: *defaults diff --git a/spec/support/factory_girl.rb b/spec/support/factory_girl.rb new file mode 100644 index 00000000..51f4037c --- /dev/null +++ b/spec/support/factory_girl.rb @@ -0,0 +1,7 @@ +RSpec.configure do |config| + + config.before(:suite) do + FactoryGirl.lint if CONFIG['factory_girl_lint'] + end + +end