Skip to content

Instantly share code, notes, and snippets.

@benphelps
Created March 22, 2017 18:00
Show Gist options
  • Save benphelps/be5deea7a931f61720a6de9d874c381c to your computer and use it in GitHub Desktop.
Save benphelps/be5deea7a931f61720a6de9d874c381c to your computer and use it in GitHub Desktop.
require 'active_support/inflector'
guard :rspec, cmd: 'WAT=wat spring rspec' + (ENV['DOC_FORMAT'] ? ' --format documentation' : ''), notification: false do
watch(%r{^spec/features/.+_spec\.rb$})
watch(%r{^spec/models/.+_spec\.rb$})
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1].singularize}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| "spec/features/#{m[1].singularize}_spec.rb" }
watch(%r{^app/models/(.+)\.rb$}) { |m| "spec/models/#{m[1]}_spec.rb" }
watch(%r{^spec/factories/(.+)_spec\.rb$}) do |m|
["app/models/#{m[1].singularize}.rb", "spec/models/#{m[1].singularize}_spec.rb"]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment