scm: cvs: code clean up functional test.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5081 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-03-11 00:42:21 +00:00
parent 28feb58754
commit f41848fda4
1 changed files with 15 additions and 15 deletions

View File

@ -39,13 +39,13 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
User.current = nil User.current = nil
@project = Project.find(PRJ_ID) @project = Project.find(PRJ_ID)
@repository = Repository::Cvs.create(:project => Project.find(PRJ_ID), @repository = Repository::Cvs.create(:project => Project.find(PRJ_ID),
:root_url => REPOSITORY_PATH, :root_url => REPOSITORY_PATH,
:url => MODULE_NAME, :url => MODULE_NAME,
:log_encoding => 'UTF-8') :log_encoding => 'UTF-8')
assert @repository assert @repository
end end
if File.directory?(REPOSITORY_PATH) if File.directory?(REPOSITORY_PATH)
def test_show def test_show
@repository.fetch_changesets @repository.fetch_changesets
@ -56,7 +56,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_not_nil assigns(:entries) assert_not_nil assigns(:entries)
assert_not_nil assigns(:changesets) assert_not_nil assigns(:changesets)
end end
def test_browse_root def test_browse_root
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
@ -65,14 +65,14 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_template 'show' assert_template 'show'
assert_not_nil assigns(:entries) assert_not_nil assigns(:entries)
assert_equal 3, assigns(:entries).size assert_equal 3, assigns(:entries).size
entry = assigns(:entries).detect {|e| e.name == 'images'} entry = assigns(:entries).detect {|e| e.name == 'images'}
assert_equal 'dir', entry.kind assert_equal 'dir', entry.kind
entry = assigns(:entries).detect {|e| e.name == 'README'} entry = assigns(:entries).detect {|e| e.name == 'README'}
assert_equal 'file', entry.kind assert_equal 'file', entry.kind
end end
def test_browse_directory def test_browse_directory
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
@ -86,7 +86,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_equal 'file', entry.kind assert_equal 'file', entry.kind
assert_equal 'images/edit.png', entry.path assert_equal 'images/edit.png', entry.path
end end
def test_browse_at_given_revision def test_browse_at_given_revision
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
@ -96,7 +96,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_not_nil assigns(:entries) assert_not_nil assigns(:entries)
assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name) assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
end end
def test_entry def test_entry
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
@ -106,7 +106,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_no_tag :tag => 'td', :attributes => { :class => /line-code/}, assert_no_tag :tag => 'td', :attributes => { :class => /line-code/},
:content => /before_filter/ :content => /before_filter/
end end
def test_entry_at_given_revision def test_entry_at_given_revision
# changesets must be loaded # changesets must be loaded
@repository.fetch_changesets @repository.fetch_changesets
@ -118,7 +118,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_tag :tag => 'td', :attributes => { :class => /line-code/}, assert_tag :tag => 'td', :attributes => { :class => /line-code/},
:content => /before_filter/ :content => /before_filter/
end end
def test_entry_not_found def test_entry_not_found
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
@ -126,7 +126,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ }, assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
:content => /The entry or revision was not found in the repository/ :content => /The entry or revision was not found in the repository/
end end
def test_entry_download def test_entry_download
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
@ -143,7 +143,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_not_nil assigns(:entry) assert_not_nil assigns(:entry)
assert_equal 'sources', assigns(:entry).name assert_equal 'sources', assigns(:entry).name
end end
def test_diff def test_diff
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
@ -155,7 +155,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' }, assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
:content => /watched.remove_all_watcher/ :content => /watched.remove_all_watcher/
end end
def test_diff_new_files def test_diff_new_files
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload
@ -171,7 +171,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_tag :tag => 'th', :attributes => { :class => 'filename' }, assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/images\/edit.png/ :content => /test\/images\/edit.png/
assert_tag :tag => 'th', :attributes => { :class => 'filename' }, assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/sources\/watchers_controller.rb/ :content => /test\/sources\/watchers_controller.rb/
end end
def test_annotate def test_annotate