Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make rake test:uncommitted work with Git.

Note : rake test:uncommitted is considering only unstaged files.

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit 3a95ee73cfbcfeada3b053c5b0fb7b5125ef12c7 1 parent f5052dd
Tim Pope tpope authored lifo committed
Showing with 12 additions and 4 deletions.
  1. +2 −0  railties/CHANGELOG
  2. +10 −4 railties/lib/tasks/testing.rake
2  railties/CHANGELOG
View
@@ -1,5 +1,7 @@
*Edge*
+* Make rake test:uncommitted work with Git. [Tim Pope]
+
* Added Thin support to script/server. #488 [Bob Klosinski]
* Fix script/about in production mode. #370 [Cheah Chu Yeow, Xavier Noria, David Krmpotic]
14 railties/lib/tasks/testing.rake
View
@@ -66,10 +66,16 @@ namespace :test do
Rake::TestTask.new(:uncommitted => "db:test:prepare") do |t|
def t.file_list
- changed_since_checkin = silence_stderr { `svn status` }.map { |path| path.chomp[7 .. -1] }
+ if File.directory?(".svn")
+ changed_since_checkin = silence_stderr { `svn status` }.map { |path| path.chomp[7 .. -1] }
+ elsif File.directory?(".git")
+ changed_since_checkin = silence_stderr { `git ls-files --modified --others` }.map { |path| path.chomp }
+ else
+ abort "Not a Subversion or Git checkout."
+ end
- models = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*\.rb/ }
- controllers = changed_since_checkin.select { |path| path =~ /app[\\\/]controllers[\\\/].*\.rb/ }
+ 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" }
@@ -80,7 +86,7 @@ namespace :test do
t.libs << 'test'
t.verbose = true
end
- Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion)"
+ Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion and Git)"
Rake::TestTask.new(:units => "db:test:prepare") do |t|
t.libs << "test"
Please sign in to comment.
Something went wrong with that request. Please try again.