I use an alias to do something similar which runs `git ls-files -mo --exclude-standard | exists | grep _spec\.rb$ | xargs bundle exec rspec` you could give that a try
Jon Rowe --------------------------- [email protected] jonrowe.co.uk On Monday, 10 April 2017 at 17:20, Myron Marston wrote: > RSpec does not provide anything like this (it is agnostic about what source > control system you are using, if any). > > You could write a script to query git for the list of files that have changed > since last commit, and pass the spec files in that list to the `rspec` > command. > > HTH, > Myron > > > On Sun, Apr 9, 2017 at 1:51 PM, Alon Dahari <[email protected] > (mailto:[email protected])> wrote: > > Hi, > > I have a pre-commit hook on my project to run my rspec tests and prevent > > commit on failures. > > As the project grows, running the tests is getting slower. > > Is there a way to run only tests that touch files changed since last commit > > (staged files)? > > > > Thanks! > > > > -- > > You received this message because you are subscribed to the Google Groups > > "rspec" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected] > > (mailto:[email protected]). > > To post to this group, send email to [email protected] > > (mailto:[email protected]). > > To view this discussion on the web visit > > https://groups.google.com/d/msgid/rspec/50c0145b-36d4-431a-a6d5-4d7faf8e87a9%40googlegroups.com > > > > (https://groups.google.com/d/msgid/rspec/50c0145b-36d4-431a-a6d5-4d7faf8e87a9%40googlegroups.com?utm_medium=email&utm_source=footer). > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "rspec" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > (mailto:[email protected]). > To post to this group, send email to [email protected] > (mailto:[email protected]). > To view this discussion on the web visit > https://groups.google.com/d/msgid/rspec/CADUxQmt4aqch%2BK0bcQWr1W1rSwfqQn%2Bmb4HVg4X34-FrGdX8ag%40mail.gmail.com > > (https://groups.google.com/d/msgid/rspec/CADUxQmt4aqch%2BK0bcQWr1W1rSwfqQn%2Bmb4HVg4X34-FrGdX8ag%40mail.gmail.com?utm_medium=email&utm_source=footer). > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/E9D0F7CDCA74470292AAEE81554DB572%40jonrowe.co.uk. For more options, visit https://groups.google.com/d/optout.
