scm: mercurial: check changesets size is greater than 0 in browse test in functional test.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5122 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-03-14 10:23:51 +00:00 committed by Eric Davis
parent 9ae4b74b1e
commit 6b9b3783bc
1 changed files with 15 additions and 0 deletions

View File

@ -69,6 +69,8 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
end end
def test_show_root def test_show_root
@repository.fetch_changesets
@repository.reload
get :show, :id => 3 get :show, :id => 3
assert_response :success assert_response :success
assert_template 'show' assert_template 'show'
@ -77,9 +79,13 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'} assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'} assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'} assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
assert_not_nil assigns(:changesets)
assigns(:changesets).size > 0
end end
def test_show_directory def test_show_directory
@repository.fetch_changesets
@repository.reload
get :show, :id => 3, :path => ['images'] get :show, :id => 3, :path => ['images']
assert_response :success assert_response :success
assert_template 'show' assert_template 'show'
@ -89,19 +95,27 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
assert_not_nil entry assert_not_nil entry
assert_equal 'file', entry.kind assert_equal 'file', entry.kind
assert_equal 'images/edit.png', entry.path assert_equal 'images/edit.png', entry.path
assert_not_nil assigns(:changesets)
assigns(:changesets).size > 0
end end
def test_show_at_given_revision def test_show_at_given_revision
@repository.fetch_changesets
@repository.reload
[0, '0', '0885933ad4f6'].each do |r1| [0, '0', '0885933ad4f6'].each do |r1|
get :show, :id => 3, :path => ['images'], :rev => r1 get :show, :id => 3, :path => ['images'], :rev => r1
assert_response :success assert_response :success
assert_template 'show' assert_template 'show'
assert_not_nil assigns(:entries) assert_not_nil assigns(:entries)
assert_equal ['delete.png'], assigns(:entries).collect(&:name) assert_equal ['delete.png'], assigns(:entries).collect(&:name)
assert_not_nil assigns(:changesets)
assigns(:changesets).size > 0
end end
end end
def test_show_directory_sql_escape_percent def test_show_directory_sql_escape_percent
@repository.fetch_changesets
@repository.reload
[13, '13', '3a330eb32958'].each do |r1| [13, '13', '3a330eb32958'].each do |r1|
get :show, :id => 3, :path => ['sql_escape', 'percent%dir'], :rev => r1 get :show, :id => 3, :path => ['sql_escape', 'percent%dir'], :rev => r1
assert_response :success assert_response :success
@ -110,6 +124,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
assert_not_nil assigns(:entries) assert_not_nil assigns(:entries)
assert_equal ['percent%file1.txt', 'percentfile1.txt'], assigns(:entries).collect(&:name) assert_equal ['percent%file1.txt', 'percentfile1.txt'], assigns(:entries).collect(&:name)
changesets = assigns(:changesets) changesets = assigns(:changesets)
assigns(:changesets).size > 0
## This is not yet implemented. ## This is not yet implemented.
# assert_not_nil changesets # assert_not_nil changesets