I'm using autotest, and have added hooks to run my integration tests. While working, any time I make a change that impacts any of the integration tests, all the integration tests rerun. This is the behavior I'd like to change, if possible. (I'm using rspec with webrat for my tests, no cucumber)
With non-integration tests, the pattern is that it reruns the tests in the same spec file (or describe block?) if you change the test or what its describing. So, say we have page_controller.rb and page_controller_spec.rb. autotest knows that if you change one of those files, it runs just the tests in the page_controller_spec, then, if it passes, it runs all the tests. I'd like something similar for my integration tests -- just run the tests in the file with the failing test first, then run all tests if they pass.
my .autotest file looks like this
require "autotest/growl"
require "autotest/fsevent"
Autotest.add_hook :initialize do |autotest|
autotest.add_mapping(/^spec\/integration\/.*_spec\.rb$/) do
autotest.files_matching(/^spec\/integration\/.*_spec\.rb$/)
end
end
Your .autotest
is the source of the problem :) It basically says that for any file in /spec/integration
directory, all of them should be run. You should return only the matched filename, like this:
require "autotest/growl"
require "autotest/fsevent"
Autotest.add_hook :initialize do |autotest|
autotest.add_mapping(/^spec\/integration\/.*_spec\.rb$/) do |filename|
filename
end
end