comparison .svn/pristine/0d/0d50a39088b6bd107e54b315b0bf77a7ffa63596.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
comparison
equal deleted inserted replaced
1297:0a574315af3e 1298:4f746d8966dd
1 ### From http://svn.geekdaily.org/public/rails/plugins/generally_useful/tasks/coverage_via_rcov.rake
2
3 namespace :test do
4 desc 'Measures test coverage'
5 task :coverage do
6 rm_f "coverage"
7 rm_f "coverage.data"
8 rcov = "rcov --rails --aggregate coverage.data --text-summary -Ilib --html --exclude gems/"
9 files = %w(unit functional integration).map {|dir| Dir.glob("test/#{dir}/**/*_test.rb")}.flatten.join(" ")
10 system("#{rcov} #{files}")
11 end
12
13 desc 'Run unit and functional scm tests'
14 task :scm do
15 errors = %w(test:scm:units test:scm:functionals).collect do |task|
16 begin
17 Rake::Task[task].invoke
18 nil
19 rescue => e
20 task
21 end
22 end.compact
23 abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any?
24 end
25
26 namespace :scm do
27 namespace :setup do
28 desc "Creates directory for test repositories"
29 task :create_dir do
30 FileUtils.mkdir_p Rails.root + '/tmp/test'
31 end
32
33 supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem]
34
35 desc "Creates a test subversion repository"
36 task :subversion => :create_dir do
37 repo_path = "tmp/test/subversion_repository"
38 unless File.exists?(repo_path)
39 system "svnadmin create #{repo_path}"
40 system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}"
41 end
42 end
43
44 desc "Creates a test mercurial repository"
45 task :mercurial => :create_dir do
46 repo_path = "tmp/test/mercurial_repository"
47 unless File.exists?(repo_path)
48 bundle_path = "test/fixtures/repositories/mercurial_repository.hg"
49 system "hg init #{repo_path}"
50 system "hg -R #{repo_path} pull #{bundle_path}"
51 end
52 end
53
54 (supported_scms - [:subversion, :mercurial]).each do |scm|
55 desc "Creates a test #{scm} repository"
56 task scm => :create_dir do
57 unless File.exists?("tmp/test/#{scm}_repository")
58 # system "gunzip < test/fixtures/repositories/#{scm}_repository.tar.gz | tar -xv -C tmp/test"
59 system "tar -xvz -C tmp/test -f test/fixtures/repositories/#{scm}_repository.tar.gz"
60 end
61 end
62 end
63
64 desc "Creates all test repositories"
65 task :all => supported_scms
66 end
67
68 desc "Updates installed test repositories"
69 task :update do
70 require 'fileutils'
71 Dir.glob("tmp/test/*_repository").each do |dir|
72 next unless File.basename(dir) =~ %r{^(.+)_repository$} && File.directory?(dir)
73 scm = $1
74 next unless fixture = Dir.glob("test/fixtures/repositories/#{scm}_repository.*").first
75 next if File.stat(dir).ctime > File.stat(fixture).mtime
76
77 FileUtils.rm_rf dir
78 Rake::Task["test:scm:setup:#{scm}"].execute
79 end
80 end
81
82 Rake::TestTask.new(:units => "db:test:prepare") do |t|
83 t.libs << "test"
84 t.verbose = true
85 t.test_files = FileList['test/unit/repository*_test.rb'] + FileList['test/unit/lib/redmine/scm/**/*_test.rb']
86 end
87 Rake::Task['test:scm:units'].comment = "Run the scm unit tests"
88
89 Rake::TestTask.new(:functionals => "db:test:prepare") do |t|
90 t.libs << "test"
91 t.verbose = true
92 t.test_files = FileList['test/functional/repositories*_test.rb']
93 end
94 Rake::Task['test:scm:functionals'].comment = "Run the scm functional tests"
95 end
96
97 Rake::TestTask.new(:rdm_routing) do |t|
98 t.libs << "test"
99 t.verbose = true
100 t.test_files = FileList['test/integration/routing/*_test.rb']
101 end
102 Rake::Task['test:rdm_routing'].comment = "Run the routing tests"
103
104 Rake::TestTask.new(:ui => "db:test:prepare") do |t|
105 t.libs << "test"
106 t.verbose = true
107 t.test_files = FileList['test/ui/**/*_test.rb']
108 end
109 Rake::Task['test:ui'].comment = "Run the UI tests with Capybara (PhantomJS listening on port 4444 is required)"
110 end