Skip to content

Instantly share code, notes, and snippets.

@ruliana
Last active June 13, 2018 02:08
Show Gist options
  • Save ruliana/de85d17edab8452fe8da3fa1c0a76f5e to your computer and use it in GitHub Desktop.
Save ruliana/de85d17edab8452fe8da3fa1c0a76f5e to your computer and use it in GitHub Desktop.
Guardfile to run rubocop after tests pass
# Run rubocop after all tests pass
group :tdd, halt_on_fail: true do
guard :rspec,
cmd: 'bundle exec rspec -f documentation --color',
run_all: {cmd: 'bundle exec rspec -f documentation --color'},
keep: true,
all_on_start: true,
all_after_pass: true do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^apps/(.+)\.rb$}) { |m| "spec/apps/#{m[1]}_spec.rb" }
watch(%r{^apps/(.+)/views/(.+)\.(?:erb|builder)$}) { |m| "spec/apps/#{m[1]}/routes_spec.rb" }
watch(%r{^apps/(.+)/presenters/(.+)\.rb$}) { |m| "spec/apps/#{m[1]}/presenters/#{m[2]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
watch('lib/fairburn.rb') { 'spec' }
end
guard :rubocop, cmd: 'bundle exec rubocop', cli: '-fs -c./.rubocop.yml' do
watch(%r{.+\.rb$})
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment