@@ -33,9 +33,10 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
33 | 33 | @request = ActionController::TestRequest.new |
|
34 | 34 | @response = ActionController::TestResponse.new |
|
35 | 35 | User.current = nil |
|
36 | Repository::Git.create(:project => Project.find(3), :url => REPOSITORY_PATH) | |
|
36 | @repository = Repository::Git.create(:project => Project.find(3), :url => REPOSITORY_PATH) | |
|
37 | assert @repository | |
|
37 | 38 | end |
|
38 | ||
|
39 | ||
|
39 | 40 | if File.directory?(REPOSITORY_PATH) |
|
40 | 41 | def test_show |
|
41 | 42 | get :show, :id => 3 |
@@ -126,8 +127,11 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
126 | 127 | assert_not_nil assigns(:entry) |
|
127 | 128 | assert_equal 'sources', assigns(:entry).name |
|
128 | 129 | end |
|
129 | ||
|
130 | ||
|
130 | 131 | def test_diff |
|
132 | @repository.fetch_changesets | |
|
133 | @repository.reload | |
|
134 | ||
|
131 | 135 | # Full diff of changeset 2f9c0091 |
|
132 | 136 | get :diff, :id => 3, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' |
|
133 | 137 | assert_response :success |
@@ -138,6 +142,21 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
138 | 142 | :sibling => { :tag => 'td', |
|
139 | 143 | :attributes => { :class => /diff_out/ }, |
|
140 | 144 | :content => /def remove/ } |
|
145 | assert_tag :tag => 'h2', :content => /2f9c0091/ | |
|
146 | end | |
|
147 | ||
|
148 | def test_diff_two_revs | |
|
149 | @repository.fetch_changesets | |
|
150 | @repository.reload | |
|
151 | ||
|
152 | get :diff, :id => 3, :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1', | |
|
153 | :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' | |
|
154 | assert_response :success | |
|
155 | assert_template 'diff' | |
|
156 | ||
|
157 | diff = assigns(:diff) | |
|
158 | assert_not_nil diff | |
|
159 | assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/ | |
|
141 | 160 | end |
|
142 | 161 | |
|
143 | 162 | def test_annotate |
@@ -150,7 +169,7 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
150 | 169 | :sibling => { :tag => 'td', :content => /jsmith/ }, |
|
151 | 170 | :sibling => { :tag => 'td', :content => /watcher =/ } |
|
152 | 171 | end |
|
153 | ||
|
172 | ||
|
154 | 173 | def test_annotate_binary_file |
|
155 | 174 | get :annotate, :id => 3, :path => ['images', 'edit.png'] |
|
156 | 175 | assert_response 500 |
@@ -198,6 +198,8 class RepositoriesSubversionControllerTest < ActionController::TestCase | |||
|
198 | 198 | get :diff, :id => 1, :rev => 3 |
|
199 | 199 | assert_response :success |
|
200 | 200 | assert_template 'diff' |
|
201 | ||
|
202 | assert_tag :tag => 'h2', :content => /3/ | |
|
201 | 203 | end |
|
202 | 204 | |
|
203 | 205 | def test_directory_diff |
@@ -209,6 +211,8 class RepositoriesSubversionControllerTest < ActionController::TestCase | |||
|
209 | 211 | assert_not_nil diff |
|
210 | 212 | # 2 files modified |
|
211 | 213 | assert_equal 2, Redmine::UnifiedDiff.new(diff).size |
|
214 | ||
|
215 | assert_tag :tag => 'h2', :content => /2:6/ | |
|
212 | 216 | end |
|
213 | 217 | |
|
214 | 218 | def test_annotate |
General Comments 0
You need to be logged in to leave comments.
Login now