From 3c3e16e022e63f8684fa88af78a5ea570831d296 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Mon, 14 Mar 2011 08:16:03 +0000 Subject: [PATCH] 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 --- .../repositories_git_controller_test.rb | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index 500899482..b7d86f1b9 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -43,14 +43,20 @@ class RepositoriesGitControllerTest < ActionController::TestCase if File.directory?(REPOSITORY_PATH) def test_show + @repository.fetch_changesets + @repository.reload get :show, :id => 3 assert_response :success assert_template 'show' assert_not_nil assigns(:entries) + assert assigns(:entries).size > 0 assert_not_nil assigns(:changesets) + assigns(:changesets).size > 0 end def test_browse_root + @repository.fetch_changesets + @repository.reload get :show, :id => 3 assert_response :success 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 == 'filemane with spaces.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 def test_browse_branch + @repository.fetch_changesets + @repository.reload get :show, :id => 3, :rev => 'test_branch' assert_response :success 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 == 'README' && 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 def test_browse_directory + @repository.fetch_changesets + @repository.reload get :show, :id => 3, :path => ['images'] assert_response :success assert_template 'show' @@ -89,14 +103,20 @@ class RepositoriesGitControllerTest < ActionController::TestCase assert_not_nil entry assert_equal 'file', entry.kind assert_equal 'images/edit.png', entry.path + assert_not_nil assigns(:changesets) + assigns(:changesets).size > 0 end def test_browse_at_given_revision + @repository.fetch_changesets + @repository.reload get :show, :id => 3, :path => ['images'], :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518' assert_response :success assert_template 'show' assert_not_nil assigns(:entries) assert_equal ['delete.png'], assigns(:entries).collect(&:name) + assert_not_nil assigns(:changesets) + assigns(:changesets).size > 0 end def test_changes