TeX and CSS tweaks.
Sync with latest Instiki Trunk (Updates Rails to 1.2.2)
This commit is contained in:
parent
0ac586ee25
commit
c358389f25
443 changed files with 24218 additions and 9823 deletions
41
vendor/rails/railties/lib/tasks/testing.rake
vendored
41
vendor/rails/railties/lib/tasks/testing.rake
vendored
|
@ -4,10 +4,25 @@ TEST_CHANGES_SINCE = Time.now - 600
|
|||
def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
|
||||
FileList[source_pattern].map do |path|
|
||||
if File.mtime(path) > touched_since
|
||||
test = "#{test_path}/#{File.basename(path, '.rb')}_test.rb"
|
||||
test if File.exists?(test)
|
||||
tests = []
|
||||
source_dir = File.dirname(path).split("/")
|
||||
source_file = File.basename(path, '.rb')
|
||||
|
||||
# Support subdirs in app/models and app/controllers
|
||||
modified_test_path = source_dir.length > 2 ? "#{test_path}/" << source_dir[1..source_dir.length].join('/') : test_path
|
||||
|
||||
# For modified files in app/ run the tests for it. ex. /test/functional/account_controller.rb
|
||||
test = "#{modified_test_path}/#{source_file}_test.rb"
|
||||
tests.push test if File.exists?(test)
|
||||
|
||||
# For modified files in app, run tests in subdirs too. ex. /test/functional/account/*_test.rb
|
||||
test = "#{modified_test_path}/#{File.basename(path, '.rb').sub("_controller","")}"
|
||||
FileList["#{test}/*_test.rb"].each { |f| tests.push f } if File.exists?(test)
|
||||
|
||||
return tests
|
||||
|
||||
end
|
||||
end.compact
|
||||
end.flatten.compact
|
||||
end
|
||||
|
||||
|
||||
|
@ -36,25 +51,24 @@ task :test do
|
|||
end
|
||||
|
||||
namespace :test do
|
||||
desc 'Test recent changes'
|
||||
Rake::TestTask.new(:recent => "db:test:prepare") do |t|
|
||||
since = TEST_CHANGES_SINCE
|
||||
touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
|
||||
recent_tests('app/models/*.rb', 'test/unit', since) +
|
||||
recent_tests('app/controllers/*.rb', 'test/functional', since)
|
||||
recent_tests('app/models/**/*.rb', 'test/unit', since) +
|
||||
recent_tests('app/controllers/**/*.rb', 'test/functional', since)
|
||||
|
||||
t.libs << 'test'
|
||||
t.verbose = true
|
||||
t.test_files = touched.uniq
|
||||
end
|
||||
Rake::Task['test:recent'].comment = "Test recent changes"
|
||||
|
||||
desc 'Test changes since last checkin (only Subversion)'
|
||||
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] }
|
||||
|
||||
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" }
|
||||
|
@ -65,29 +79,29 @@ namespace :test do
|
|||
t.libs << 'test'
|
||||
t.verbose = true
|
||||
end
|
||||
Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion)"
|
||||
|
||||
desc "Run the unit tests in test/unit"
|
||||
Rake::TestTask.new(:units => "db:test:prepare") do |t|
|
||||
t.libs << "test"
|
||||
t.pattern = 'test/unit/**/*_test.rb'
|
||||
t.verbose = true
|
||||
end
|
||||
Rake::Task['test:units'].comment = "Run the unit tests in test/unit"
|
||||
|
||||
desc "Run the functional tests in test/functional"
|
||||
Rake::TestTask.new(:functionals => "db:test:prepare") do |t|
|
||||
t.libs << "test"
|
||||
t.pattern = 'test/functional/**/*_test.rb'
|
||||
t.verbose = true
|
||||
end
|
||||
Rake::Task['test:functionals'].comment = "Run the functional tests in test/functional"
|
||||
|
||||
desc "Run the integration tests in test/integration"
|
||||
Rake::TestTask.new(:integration => "db:test:prepare") do |t|
|
||||
t.libs << "test"
|
||||
t.pattern = 'test/integration/**/*_test.rb'
|
||||
t.verbose = true
|
||||
end
|
||||
Rake::Task['test:integration'].comment = "Run the integration tests in test/integration"
|
||||
|
||||
desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)"
|
||||
Rake::TestTask.new(:plugins => :environment) do |t|
|
||||
t.libs << "test"
|
||||
|
||||
|
@ -99,4 +113,5 @@ namespace :test do
|
|||
|
||||
t.verbose = true
|
||||
end
|
||||
Rake::Task['test:plugins'].comment = "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue