scm: subversion: code clean up functional test.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5561 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-04-28 11:24:02 +00:00
parent 828ce5d227
commit 363d9de8bb
1 changed files with 20 additions and 18 deletions

View File

@ -51,7 +51,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_not_nil assigns(:entries)
assert_not_nil assigns(:changesets)
end
def test_browse_root
@repository.fetch_changesets
@repository.reload
@ -62,7 +62,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
entry = assigns(:entries).detect {|e| e.name == 'subversion_test'}
assert_equal 'dir', entry.kind
end
def test_browse_directory
@repository.fetch_changesets
@repository.reload
@ -70,7 +70,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_response :success
assert_template 'show'
assert_not_nil assigns(:entries)
assert_equal ['[folder_with_brackets]', 'folder', '.project', 'helloworld.c', 'textfile.txt'], assigns(:entries).collect(&:name)
assert_equal ['[folder_with_brackets]', 'folder', '.project', 'helloworld.c', 'textfile.txt'],
assigns(:entries).collect(&:name)
entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'}
assert_equal 'file', entry.kind
assert_equal 'subversion_test/helloworld.c', entry.path
@ -84,9 +85,10 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_response :success
assert_template 'show'
assert_not_nil assigns(:entries)
assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'], assigns(:entries).collect(&:name)
assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'],
assigns(:entries).collect(&:name)
end
def test_file_changes
@repository.fetch_changesets
@repository.reload
@ -115,12 +117,12 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder' ]
assert_response :success
assert_template 'changes'
changesets = assigns(:changesets)
assert_not_nil changesets
assert_equal %w(10 9 7 6 5 2), changesets.collect(&:revision)
end
def test_entry
@repository.fetch_changesets
@repository.reload
@ -128,7 +130,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_response :success
assert_template 'entry'
end
def test_entry_should_send_if_too_big
@repository.fetch_changesets
@repository.reload
@ -140,7 +142,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
end
end
def test_entry_at_given_revision
@repository.fetch_changesets
@repository.reload
@ -151,7 +153,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_tag :tag => 'td', :attributes => { :class => /line-code/},
:content => /Here's the code/
end
def test_entry_not_found
@repository.fetch_changesets
@repository.reload
@ -159,7 +161,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
:content => /The entry or revision was not found in the repository/
end
def test_entry_download
@repository.fetch_changesets
@repository.reload
@ -168,7 +170,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_template ''
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
end
def test_directory_entry
@repository.fetch_changesets
@repository.reload
@ -178,7 +180,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_not_nil assigns(:entry)
assert_equal 'folder', assigns(:entry).name
end
# TODO: this test needs fixtures.
def test_revision
@repository.fetch_changesets
@ -199,7 +201,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
}
}
end
def test_invalid_revision
@repository.fetch_changesets
@repository.reload
@ -229,7 +231,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
r = Project.find(1).repository
# Changes repository url to a subdirectory
r.update_attribute :url, (r.url + '/test/some')
get :revision, :id => 1, :rev => 2
assert_response :success
assert_template 'revision'
@ -246,7 +248,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
}
}
end
def test_revision_diff
@repository.fetch_changesets
@repository.reload
@ -263,7 +265,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2, :path => ['subversion_test', 'folder']
assert_response :success
assert_template 'diff'
diff = assigns(:diff)
assert_not_nil diff
# 2 files modified
@ -271,7 +273,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_tag :tag => 'h2', :content => /2:6/
end
def test_annotate
@repository.fetch_changesets
@repository.reload