Created
March 8, 2011 06:46
-
-
Save smathy/859955 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :test do | |
Rake::TestTask.new(:master => "test:prepare") do |t| | |
def t.file_list | |
changed_since_checkin = silence_stderr { `git diff --name-only master` }.map { |path| path.chomp } | |
models = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*\.rb$/ } | |
controllers = changed_since_checkin.select { |path| path =~ /app[\\\/]controllers[\\\/].*\.rb$/ } | |
unit_tests = models.map { |model| "test/unit/#{File.basename(model, '.rb')}_test.rb" } | |
functional_tests = controllers.map { |controller| "test/functional/#{File.basename(controller, '.rb')}_test.rb" } | |
unit_tests.uniq + functional_tests.uniq | |
end | |
t.libs << 'test' | |
end | |
Rake::Task['test:master'].comment = "Test changes for files changed in current branch (from master)" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment