From 17d455c72f4d1e4bfab90e8654fe9db120734578 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 12 Jan 2009 04:44:01 +0000 Subject: [PATCH] Codified instructions from RUNNING_TESTS as rake tasks for convenience Rake tasks are in testing.rake and can be run by `rake test:scm:setup:` Updated RUNNING_TESTS Contributed by Gerrit Kaiser git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2260 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- doc/RUNNING_TESTS | 48 ++++++++---------------------------------- lib/tasks/testing.rake | 30 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/doc/RUNNING_TESTS b/doc/RUNNING_TESTS index b2d3008d..b5bfa386 100644 --- a/doc/RUNNING_TESTS +++ b/doc/RUNNING_TESTS @@ -1,46 +1,16 @@ -Creating test repositories -=================== - -mkdir tmp/test - -Subversion ----------- -svnadmin create tmp/test/subversion_repository -gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load tmp/test/subversion_repository - -CVS ---- -gunzip < test/fixtures/repositories/cvs_repository.tar.gz | tar -xv -C tmp/test - -Bazaar ------- -gunzip < test/fixtures/repositories/bazaar_repository.tar.gz | tar -xv -C tmp/test - -Mercurial ---------- -gunzip < test/fixtures/repositories/mercurial_repository.tar.gz | tar -xv -C tmp/test - -Git ---- -gunzip < test/fixtures/repositories/git_repository.tar.gz | tar -xv -C tmp/test - -Darcs (2.0+ required) ---------------------- -gunzip < test/fixtures/repositories/darcs_repository.tar.gz | tar -xv -C tmp/test - -FileSystem ----------- -gunzip < test/fixtures/repositories/filesystem_repository.tar.gz | tar -xv -C tmp/test - - Running Tests ============= -Run +Run `rake --tasks test` to see available tests. +`rake test` will run the entire testsuite. - rake --tasks | grep test -to see available tests. +Creating test repositories +=================== -RAILS_ENV=test rake test will run tests. +Redmine supports a wide array of different version control systems. +To test the support, a test repository needs to be created for each of those. + +Run `rake --tasks test:scm:setup` for a list of available test-repositories or +run `rake test:scm:setup:all` to set up all of them diff --git a/lib/tasks/testing.rake b/lib/tasks/testing.rake index 42f756f6..da832b3e 100644 --- a/lib/tasks/testing.rake +++ b/lib/tasks/testing.rake @@ -1,5 +1,35 @@ ### From http://svn.geekdaily.org/public/rails/plugins/generally_useful/tasks/coverage_via_rcov.rake +namespace :test do + namespace :scm do + namespace :setup do + desc "Creates directory for test repositories" + task :create_dir do + FileUtils.mkdir_p Rails.root + '/tmp/test' + end + + supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem] + + desc "Creates a test subversion repository" + task :subversion => :create_dir do + repo_path = "tmp/test/subversion_repository" + system "svnadmin create #{repo_path}" + system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}" + end + + (supported_scms - [:subversion]).each do |scm| + desc "Creates a test #{scm} repository" + task scm => :create_dir do + system "gunzip < test/fixtures/repositories/#{scm}_repository.tar.gz | tar -xv -C tmp/test" + end + end + + desc "Creates all test repositories" + task :all => supported_scms + end + end +end + ### Inspired by http://blog.labratz.net/articles/2006/12/2/a-rake-task-for-rcov begin require 'rcov/rcovtask'