##// END OF EJS Templates
scm: add compatible functional test fof changing diff revisions label at SCM adapter level....
Toshi MARUYAMA -
r4545:e4f72a8e3afb
parent child
Show More
@@ -33,9 +33,10 class RepositoriesGitControllerTest < ActionController::TestCase
33 @request = ActionController::TestRequest.new
33 @request = ActionController::TestRequest.new
34 @response = ActionController::TestResponse.new
34 @response = ActionController::TestResponse.new
35 User.current = nil
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 end
38 end
38
39
39 if File.directory?(REPOSITORY_PATH)
40 if File.directory?(REPOSITORY_PATH)
40 def test_show
41 def test_show
41 get :show, :id => 3
42 get :show, :id => 3
@@ -126,8 +127,11 class RepositoriesGitControllerTest < ActionController::TestCase
126 assert_not_nil assigns(:entry)
127 assert_not_nil assigns(:entry)
127 assert_equal 'sources', assigns(:entry).name
128 assert_equal 'sources', assigns(:entry).name
128 end
129 end
129
130
130 def test_diff
131 def test_diff
132 @repository.fetch_changesets
133 @repository.reload
134
131 # Full diff of changeset 2f9c0091
135 # Full diff of changeset 2f9c0091
132 get :diff, :id => 3, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
136 get :diff, :id => 3, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
133 assert_response :success
137 assert_response :success
@@ -138,6 +142,21 class RepositoriesGitControllerTest < ActionController::TestCase
138 :sibling => { :tag => 'td',
142 :sibling => { :tag => 'td',
139 :attributes => { :class => /diff_out/ },
143 :attributes => { :class => /diff_out/ },
140 :content => /def remove/ }
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 end
160 end
142
161
143 def test_annotate
162 def test_annotate
@@ -150,7 +169,7 class RepositoriesGitControllerTest < ActionController::TestCase
150 :sibling => { :tag => 'td', :content => /jsmith/ },
169 :sibling => { :tag => 'td', :content => /jsmith/ },
151 :sibling => { :tag => 'td', :content => /watcher =/ }
170 :sibling => { :tag => 'td', :content => /watcher =/ }
152 end
171 end
153
172
154 def test_annotate_binary_file
173 def test_annotate_binary_file
155 get :annotate, :id => 3, :path => ['images', 'edit.png']
174 get :annotate, :id => 3, :path => ['images', 'edit.png']
156 assert_response 500
175 assert_response 500
@@ -198,6 +198,8 class RepositoriesSubversionControllerTest < ActionController::TestCase
198 get :diff, :id => 1, :rev => 3
198 get :diff, :id => 1, :rev => 3
199 assert_response :success
199 assert_response :success
200 assert_template 'diff'
200 assert_template 'diff'
201
202 assert_tag :tag => 'h2', :content => /3/
201 end
203 end
202
204
203 def test_directory_diff
205 def test_directory_diff
@@ -209,6 +211,8 class RepositoriesSubversionControllerTest < ActionController::TestCase
209 assert_not_nil diff
211 assert_not_nil diff
210 # 2 files modified
212 # 2 files modified
211 assert_equal 2, Redmine::UnifiedDiff.new(diff).size
213 assert_equal 2, Redmine::UnifiedDiff.new(diff).size
214
215 assert_tag :tag => 'h2', :content => /2:6/
212 end
216 end
213
217
214 def test_annotate
218 def test_annotate
General Comments 0
You need to be logged in to leave comments. Login now