@@ -1,6 +1,11 | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | |
|
3 | # This file includes UTF-8 "Felix Schäfer". | |
|
4 | # We need to consider Ruby 1.9 compatibity. | |
|
5 | ||
|
3 | 6 | require File.expand_path('../../../../../../test_helper', __FILE__) |
|
7 | begin | |
|
8 | require 'mocha' | |
|
4 | 9 | |
|
5 | 10 | class GitAdapterTest < ActiveSupport::TestCase |
|
6 | 11 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository' |
@@ -23,15 +28,20 class GitAdapterTest < ActiveSupport::TestCase | |||
|
23 | 28 | end |
|
24 | 29 | |
|
25 | 30 | def test_getting_revisions_with_spaces_in_filename |
|
26 |
assert_equal 1, @adapter.revisions("filemane with spaces.txt", |
|
|
31 | assert_equal 1, @adapter.revisions("filemane with spaces.txt", | |
|
32 | nil, nil, :all => true).length | |
|
27 | 33 | end |
|
28 | 34 | |
|
29 | 35 | def test_getting_revisions_with_leading_and_trailing_spaces_in_filename |
|
30 | assert_equal " filename with a leading space.txt ", @adapter.revisions(" filename with a leading space.txt ", nil, nil, :all => true)[0].paths[0][:path] | |
|
36 | assert_equal " filename with a leading space.txt ", | |
|
37 | @adapter.revisions(" filename with a leading space.txt ", | |
|
38 | nil, nil, :all => true)[0].paths[0][:path] | |
|
31 | 39 | end |
|
32 | 40 | |
|
33 | 41 | def test_getting_entries_with_leading_and_trailing_spaces_in_filename |
|
34 |
assert_equal " filename with a leading space.txt ", |
|
|
42 | assert_equal " filename with a leading space.txt ", | |
|
43 | @adapter.entries('', | |
|
44 | '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c')[3].name | |
|
35 | 45 | end |
|
36 | 46 | |
|
37 | 47 | def test_annotate |
@@ -39,7 +49,8 class GitAdapterTest < ActiveSupport::TestCase | |||
|
39 | 49 | assert_kind_of Redmine::Scm::Adapters::Annotate, annotate |
|
40 | 50 | assert_equal 41, annotate.lines.size |
|
41 | 51 | assert_equal "# This program is free software; you can redistribute it and/or", annotate.lines[4].strip |
|
42 |
assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", |
|
|
52 | assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", | |
|
53 | annotate.revisions[4].identifier | |
|
43 | 54 | assert_equal "jsmith", annotate.revisions[4].author |
|
44 | 55 | end |
|
45 | 56 | |
@@ -50,7 +61,8 class GitAdapterTest < ActiveSupport::TestCase | |||
|
50 | 61 | end |
|
51 | 62 | |
|
52 | 63 | def test_last_rev |
|
53 |
last_rev = @adapter.lastrev("README", |
|
|
64 | last_rev = @adapter.lastrev("README", | |
|
65 | "4f26664364207fa8b1af9f8722647ab2d4ac5d43") | |
|
54 | 66 | assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", last_rev.scmid |
|
55 | 67 | assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", last_rev.identifier |
|
56 | 68 | assert_equal "Adam Soltys <asoltys@gmail.com>", last_rev.author |
@@ -58,10 +70,12 class GitAdapterTest < ActiveSupport::TestCase | |||
|
58 | 70 | end |
|
59 | 71 | |
|
60 | 72 | def test_last_rev_with_spaces_in_filename |
|
61 |
last_rev = @adapter.lastrev("filemane with spaces.txt", |
|
|
73 | last_rev = @adapter.lastrev("filemane with spaces.txt", | |
|
74 | "ed5bb786bbda2dee66a2d50faf51429dbc043a7b") | |
|
62 | 75 | assert_equal "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", last_rev.scmid |
|
63 | 76 | assert_equal "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", last_rev.identifier |
|
64 |
assert_equal "Felix Schäfer <felix@fachschaften.org>", |
|
|
77 | assert_equal "Felix Schäfer <felix@fachschaften.org>", | |
|
78 | last_rev.author | |
|
65 | 79 | assert_equal "2010-09-18 19:59:46".to_time, last_rev.time |
|
66 | 80 | end |
|
67 | 81 | else |
@@ -69,3 +83,10 class GitAdapterTest < ActiveSupport::TestCase | |||
|
69 | 83 | def test_fake; assert true end |
|
70 | 84 | end |
|
71 | 85 | end |
|
86 | ||
|
87 | rescue LoadError | |
|
88 | class GitMochaFake < ActiveSupport::TestCase | |
|
89 | def test_fake; assert(false, "Requires mocha to run those tests") end | |
|
90 | end | |
|
91 | end | |
|
92 |
General Comments 0
You need to be logged in to leave comments.
Login now