@@ -1,46 +1,16 | |||
|
1 | Creating test repositories | |
|
2 | =================== | |
|
3 | ||
|
4 | mkdir tmp/test | |
|
5 | ||
|
6 | Subversion | |
|
7 | ---------- | |
|
8 | svnadmin create tmp/test/subversion_repository | |
|
9 | gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load tmp/test/subversion_repository | |
|
10 | ||
|
11 | CVS | |
|
12 | --- | |
|
13 | gunzip < test/fixtures/repositories/cvs_repository.tar.gz | tar -xv -C tmp/test | |
|
14 | ||
|
15 | Bazaar | |
|
16 | ------ | |
|
17 | gunzip < test/fixtures/repositories/bazaar_repository.tar.gz | tar -xv -C tmp/test | |
|
18 | ||
|
19 | Mercurial | |
|
20 | --------- | |
|
21 | gunzip < test/fixtures/repositories/mercurial_repository.tar.gz | tar -xv -C tmp/test | |
|
22 | ||
|
23 | Git | |
|
24 | --- | |
|
25 | gunzip < test/fixtures/repositories/git_repository.tar.gz | tar -xv -C tmp/test | |
|
26 | ||
|
27 | Darcs (2.0+ required) | |
|
28 | --------------------- | |
|
29 | gunzip < test/fixtures/repositories/darcs_repository.tar.gz | tar -xv -C tmp/test | |
|
30 | ||
|
31 | FileSystem | |
|
32 | ---------- | |
|
33 | gunzip < test/fixtures/repositories/filesystem_repository.tar.gz | tar -xv -C tmp/test | |
|
34 | ||
|
35 | ||
|
36 | 1 | Running Tests |
|
37 | 2 | ============= |
|
38 | 3 | |
|
39 | Run | |
|
4 | Run `rake --tasks test` to see available tests. | |
|
5 | `rake test` will run the entire testsuite. | |
|
40 | 6 | |
|
41 | rake --tasks | grep test | |
|
42 | 7 | |
|
43 | to see available tests. | |
|
8 | Creating test repositories | |
|
9 | =================== | |
|
10 | ||
|
11 | Redmine supports a wide array of different version control systems. | |
|
12 | To test the support, a test repository needs to be created for each of those. | |
|
44 | 13 | |
|
45 | RAILS_ENV=test rake test will run tests. | |
|
14 | Run `rake --tasks test:scm:setup` for a list of available test-repositories or | |
|
15 | run `rake test:scm:setup:all` to set up all of them | |
|
46 | 16 |
@@ -1,46 +1,76 | |||
|
1 | 1 | ### From http://svn.geekdaily.org/public/rails/plugins/generally_useful/tasks/coverage_via_rcov.rake |
|
2 | 2 | |
|
3 | namespace :test do | |
|
4 | namespace :scm do | |
|
5 | namespace :setup do | |
|
6 | desc "Creates directory for test repositories" | |
|
7 | task :create_dir do | |
|
8 | FileUtils.mkdir_p Rails.root + '/tmp/test' | |
|
9 | end | |
|
10 | ||
|
11 | supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem] | |
|
12 | ||
|
13 | desc "Creates a test subversion repository" | |
|
14 | task :subversion => :create_dir do | |
|
15 | repo_path = "tmp/test/subversion_repository" | |
|
16 | system "svnadmin create #{repo_path}" | |
|
17 | system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}" | |
|
18 | end | |
|
19 | ||
|
20 | (supported_scms - [:subversion]).each do |scm| | |
|
21 | desc "Creates a test #{scm} repository" | |
|
22 | task scm => :create_dir do | |
|
23 | system "gunzip < test/fixtures/repositories/#{scm}_repository.tar.gz | tar -xv -C tmp/test" | |
|
24 | end | |
|
25 | end | |
|
26 | ||
|
27 | desc "Creates all test repositories" | |
|
28 | task :all => supported_scms | |
|
29 | end | |
|
30 | end | |
|
31 | end | |
|
32 | ||
|
3 | 33 | ### Inspired by http://blog.labratz.net/articles/2006/12/2/a-rake-task-for-rcov |
|
4 | 34 | begin |
|
5 | 35 | require 'rcov/rcovtask' |
|
6 | 36 | |
|
7 | 37 | rcov_options = "--rails --aggregate test/coverage.data --exclude '/gems/'" |
|
8 | 38 | |
|
9 | 39 | namespace :test do |
|
10 | 40 | desc "Aggregate code coverage for all tests" |
|
11 | 41 | Rcov::RcovTask.new('coverage') do |t| |
|
12 | 42 | t.libs << 'test' |
|
13 | 43 | t.test_files = FileList['test/{unit,integration,functional}/*_test.rb'] |
|
14 | 44 | t.verbose = true |
|
15 | 45 | t.rcov_opts << rcov_options |
|
16 | 46 | end |
|
17 | 47 | |
|
18 | 48 | namespace :coverage do |
|
19 | 49 | desc "Delete coverage test data" |
|
20 | 50 | task :clean do |
|
21 | 51 | rm_f "test/coverage.data" |
|
22 | 52 | rm_rf "test/coverage" |
|
23 | 53 | end |
|
24 | 54 | |
|
25 | 55 | desc "Aggregate code coverage for all tests with HTML output" |
|
26 | 56 | Rcov::RcovTask.new('html') do |t| |
|
27 | 57 | t.libs << 'test' |
|
28 | 58 | t.test_files = FileList['test/{unit,integration,functional}/*_test.rb'] |
|
29 | 59 | t.output_dir = "test/coverage" |
|
30 | 60 | t.verbose = true |
|
31 | 61 | t.rcov_opts << rcov_options |
|
32 | 62 | end |
|
33 | 63 | |
|
34 | 64 | desc "Open the HTML coverage report" |
|
35 | 65 | task :show_results do |
|
36 | 66 | system "open test/coverage/index.html" |
|
37 | 67 | end |
|
38 | 68 | |
|
39 | 69 | task :full => "test:coverage:clean" |
|
40 | 70 | task :full => "test:coverage:html" |
|
41 | 71 | task :full => "test:coverage:show_results" |
|
42 | 72 | end |
|
43 | 73 | end |
|
44 | 74 | rescue LoadError |
|
45 | 75 | # rcov not available |
|
46 | 76 | end |
General Comments 0
You need to be logged in to leave comments.
Login now