scm: git: check entries and changesets size are greater than 0 in browse test in functional test.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5120 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-03-14 08:16:03 +00:00
parent 953e8e0f72
commit 3c3e16e022
1 changed files with 20 additions and 0 deletions

View File

@ -43,14 +43,20 @@ class RepositoriesGitControllerTest < ActionController::TestCase
if File.directory?(REPOSITORY_PATH) if File.directory?(REPOSITORY_PATH)
def test_show def test_show
@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'
assert_not_nil assigns(:entries) assert_not_nil assigns(:entries)
assert assigns(:entries).size > 0
assert_not_nil assigns(:changesets) assert_not_nil assigns(:changesets)
assigns(:changesets).size > 0
end end
def test_browse_root def test_browse_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'
@ -65,9 +71,13 @@ class RepositoriesGitControllerTest < ActionController::TestCase
assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'} assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'} assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'} assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'}
assert_not_nil assigns(:changesets)
assigns(:changesets).size > 0
end end
def test_browse_branch def test_browse_branch
@repository.fetch_changesets
@repository.reload
get :show, :id => 3, :rev => 'test_branch' get :show, :id => 3, :rev => 'test_branch'
assert_response :success assert_response :success
assert_template 'show' assert_template 'show'
@ -77,9 +87,13 @@ class RepositoriesGitControllerTest < ActionController::TestCase
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 assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'} assert assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'}
assert_not_nil assigns(:changesets)
assigns(:changesets).size > 0
end end
def test_browse_directory def test_browse_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,14 +103,20 @@ class RepositoriesGitControllerTest < 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_browse_at_given_revision def test_browse_at_given_revision
@repository.fetch_changesets
@repository.reload
get :show, :id => 3, :path => ['images'], :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518' get :show, :id => 3, :path => ['images'], :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518'
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
def test_changes def test_changes