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