Mercurial > hg > soundsoftware-site
comparison lib/tasks/.svn/text-base/testing.rake.svn-base @ 118:b859cc0c4fa1 cannam
Merge from branch "redmine-1.1"
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 13:21:03 +0000 |
parents | af80e5618e9b |
children | 051f544170fe |
comparison
equal
deleted
inserted
replaced
114:8a205cc048de | 118:b859cc0c4fa1 |
---|---|
7 rm_f "coverage.data" | 7 rm_f "coverage.data" |
8 rcov = "rcov --rails --aggregate coverage.data --text-summary -Ilib --html" | 8 rcov = "rcov --rails --aggregate coverage.data --text-summary -Ilib --html" |
9 files = Dir.glob("test/**/*_test.rb").join(" ") | 9 files = Dir.glob("test/**/*_test.rb").join(" ") |
10 system("#{rcov} #{files}") | 10 system("#{rcov} #{files}") |
11 system("open coverage/index.html") if PLATFORM['darwin'] | 11 system("open coverage/index.html") if PLATFORM['darwin'] |
12 end | |
13 | |
14 desc 'Run unit and functional scm tests' | |
15 task :scm do | |
16 errors = %w(test:scm:units test:scm:functionals).collect do |task| | |
17 begin | |
18 Rake::Task[task].invoke | |
19 nil | |
20 rescue => e | |
21 task | |
22 end | |
23 end.compact | |
24 abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any? | |
12 end | 25 end |
13 | 26 |
14 namespace :scm do | 27 namespace :scm do |
15 namespace :setup do | 28 namespace :setup do |
16 desc "Creates directory for test repositories" | 29 desc "Creates directory for test repositories" |
25 repo_path = "tmp/test/subversion_repository" | 38 repo_path = "tmp/test/subversion_repository" |
26 system "svnadmin create #{repo_path}" | 39 system "svnadmin create #{repo_path}" |
27 system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}" | 40 system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}" |
28 end | 41 end |
29 | 42 |
30 (supported_scms - [:subversion]).each do |scm| | 43 desc "Creates a test mercurial repository" |
44 task :mercurial => :create_dir do | |
45 repo_path = "tmp/test/mercurial_repository" | |
46 bundle_path = "test/fixtures/repositories/mercurial_repository.hg" | |
47 system "hg init #{repo_path}" | |
48 system "hg -R #{repo_path} pull #{bundle_path}" | |
49 end | |
50 | |
51 (supported_scms - [:subversion, :mercurial]).each do |scm| | |
31 desc "Creates a test #{scm} repository" | 52 desc "Creates a test #{scm} repository" |
32 task scm => :create_dir do | 53 task scm => :create_dir do |
33 system "gunzip < test/fixtures/repositories/#{scm}_repository.tar.gz | tar -xv -C tmp/test" | 54 system "gunzip < test/fixtures/repositories/#{scm}_repository.tar.gz | tar -xv -C tmp/test" |
34 end | 55 end |
35 end | 56 end |
36 | 57 |
37 desc "Creates all test repositories" | 58 desc "Creates all test repositories" |
38 task :all => supported_scms | 59 task :all => supported_scms |
39 end | 60 end |
61 | |
62 desc "Updates installed test repositories" | |
63 task :update do | |
64 require 'fileutils' | |
65 Dir.glob("tmp/test/*_repository").each do |dir| | |
66 next unless File.basename(dir) =~ %r{^(.+)_repository$} && File.directory?(dir) | |
67 scm = $1 | |
68 next unless fixture = Dir.glob("test/fixtures/repositories/#{scm}_repository.*").first | |
69 next if File.stat(dir).ctime > File.stat(fixture).mtime | |
70 | |
71 FileUtils.rm_rf dir | |
72 Rake::Task["test:scm:setup:#{scm}"].execute | |
73 end | |
74 end | |
75 | |
76 Rake::TestTask.new(:units => "db:test:prepare") do |t| | |
77 t.libs << "test" | |
78 t.verbose = true | |
79 t.test_files = FileList['test/unit/repository*_test.rb'] + FileList['test/unit/lib/redmine/scm/**/*_test.rb'] | |
80 end | |
81 Rake::Task['test:scm:units'].comment = "Run the scm unit tests" | |
82 | |
83 Rake::TestTask.new(:functionals => "db:test:prepare") do |t| | |
84 t.libs << "test" | |
85 t.verbose = true | |
86 t.test_files = FileList['test/functional/repositories*_test.rb'] | |
87 end | |
88 Rake::Task['test:scm:functionals'].comment = "Run the scm functional tests" | |
40 end | 89 end |
41 end | 90 end |