git-svn-id: http://svn.redmine.org/redmine/trunk@15725 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/3.4.0
@@ -44,48 +44,49 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest | |||
@project.repository.destroy | |||
get :new, :project_id => 'subproject1', :repository_scm => 'Bazaar' | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Bazaar, assigns(:repository) | |||
assert assigns(:repository).new_record? | |||
assert_select 'select[name=?]', 'repository_scm' do | |||
assert_select 'option[value=?][selected=selected]', 'Bazaar' | |||
end | |||
end | |||
def test_browse_root | |||
get :show, :id => PRJ_ID | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal 2, assigns(:entries).size | |||
assert assigns(:entries).detect {|e| e.name == 'directory' && e.kind == 'dir'} | |||
assert assigns(:entries).detect {|e| e.name == 'doc-mkdir.txt' && e.kind == 'file'} | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 2 | |||
assert_select 'tr.dir td.filename a', :text => 'directory' | |||
assert_select 'tr.file td.filename a', :text => 'doc-mkdir.txt' | |||
end | |||
end | |||
def test_browse_directory | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['directory'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['doc-ls.txt', 'document.txt', 'edit.png'], assigns(:entries).collect(&:name) | |||
entry = assigns(:entries).detect {|e| e.name == 'edit.png'} | |||
assert_not_nil entry | |||
assert_equal 'file', entry.kind | |||
assert_equal 'directory/edit.png', entry.path | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 3 | |||
assert_select 'tr.file td.filename a', :text => 'doc-ls.txt' | |||
assert_select 'tr.file td.filename a', :text => 'document.txt' | |||
assert_select 'tr.file td.filename a', :text => 'edit.png' | |||
end | |||
end | |||
def test_browse_at_given_revision | |||
get :show, :id => PRJ_ID, :path => repository_path_hash([])[:param], | |||
:rev => 3 | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['directory', 'doc-deleted.txt', 'doc-ls.txt', 'doc-mkdir.txt'], | |||
assigns(:entries).collect(&:name) | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 4 | |||
assert_select 'tr.dir td.filename a', :text => 'directory' | |||
assert_select 'tr.file td.filename a', :text => 'doc-deleted.txt' | |||
assert_select 'tr.file td.filename a', :text => 'doc-ls.txt' | |||
assert_select 'tr.file td.filename a', :text => 'doc-mkdir.txt' | |||
end | |||
end | |||
def test_changes | |||
get :changes, :id => PRJ_ID, | |||
:path => repository_path_hash(['doc-mkdir.txt'])[:param] | |||
assert_response :success | |||
assert_template 'changes' | |||
assert_select 'h2', :text => /doc-mkdir.txt/ | |||
end | |||
@@ -93,7 +94,6 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['directory', 'doc-ls.txt'])[:param] | |||
assert_response :success | |||
assert_template 'entry' | |||
# Line 19 | |||
assert_select 'tr#L29 td.line-code', :text => /Show help message/ | |||
end | |||
@@ -111,9 +111,7 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['directory'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entry) | |||
assert_equal 'directory', assigns(:entry).name | |||
assert_select 'table.entries tbody' | |||
end | |||
def test_diff | |||
@@ -121,7 +119,6 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest | |||
['inline', 'sbs'].each do |dt| | |||
get :diff, :id => PRJ_ID, :rev => 3, :type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
# Line 11 removed | |||
assert_select 'th.line-num:contains(11) ~ td.diff_out', :text => /Display more information/ | |||
end | |||
@@ -131,7 +128,7 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, | |||
:path => repository_path_hash(['doc-mkdir.txt'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
assert_select "th.line-num", :text => '2' do | |||
assert_select "+ td.revision" do | |||
assert_select "a", :text => '3' | |||
@@ -153,7 +150,7 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, :repository_id => 'author_escaping', | |||
:path => repository_path_hash(['author-escaping-test.txt'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
assert_select "th.line-num", :text => '1' do | |||
assert_select "+ td.revision" do | |||
assert_select "a", :text => '2' | |||
@@ -181,7 +178,7 @@ class RepositoriesBazaarControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, :repository_id => 'author_non_ascii', | |||
:path => repository_path_hash(['author-non-ascii-test.txt'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
assert_select "th.line-num", :text => '1' do | |||
assert_select "+ td.revision" do | |||
assert_select "a", :text => '2' |
@@ -30,9 +30,9 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
@request.session[:user_id] = 1 | |||
get :new, :project_id => 'subproject1' | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Subversion, assigns(:repository) | |||
assert assigns(:repository).new_record? | |||
assert_select 'select[name=?]', 'repository_scm' do | |||
assert_select 'option[value=?][selected=selected]', 'Subversion' | |||
end | |||
assert_select 'input[name=?]:not([disabled])', 'repository[url]' | |||
end | |||
@@ -42,8 +42,6 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
get :new, :project_id => 'subproject1' | |||
end | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Mercurial, assigns(:repository) | |||
assert_select 'select[name=repository_scm]' do | |||
assert_select 'option', 3 | |||
@@ -73,17 +71,16 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
:repository => {:url => 'invalid'} | |||
end | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Subversion, assigns(:repository) | |||
assert assigns(:repository).new_record? | |||
assert_select_error /URL is invalid/ | |||
assert_select 'select[name=?]', 'repository_scm' do | |||
assert_select 'option[value=?][selected=selected]', 'Subversion' | |||
end | |||
end | |||
def test_edit | |||
@request.session[:user_id] = 1 | |||
get :edit, :id => 11 | |||
assert_response :success | |||
assert_template 'edit' | |||
assert_equal Repository.find(11), assigns(:repository) | |||
assert_select 'input[name=?][value=?][disabled=disabled]', 'repository[url]', 'svn://localhost/test' | |||
end | |||
@@ -98,8 +95,7 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
@request.session[:user_id] = 1 | |||
put :update, :id => 11, :repository => {:password => 'x'*260} | |||
assert_response :success | |||
assert_template 'edit' | |||
assert_equal Repository.find(11), assigns(:repository) | |||
assert_select_error /Password is too long/ | |||
end | |||
def test_destroy | |||
@@ -139,9 +135,7 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
def test_revisions | |||
get :revisions, :id => 1 | |||
assert_response :success | |||
assert_template 'revisions' | |||
assert_equal Repository.find(10), assigns(:repository) | |||
assert_not_nil assigns(:changesets) | |||
assert_select 'table.changesets' | |||
end | |||
def test_revisions_for_other_repository | |||
@@ -149,9 +143,7 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
get :revisions, :id => 1, :repository_id => 'foo' | |||
assert_response :success | |||
assert_template 'revisions' | |||
assert_equal repository, assigns(:repository) | |||
assert_not_nil assigns(:changesets) | |||
assert_select 'table.changesets' | |||
end | |||
def test_revisions_for_invalid_repository | |||
@@ -162,8 +154,7 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
def test_revision | |||
get :revision, :id => 1, :rev => 1 | |||
assert_response :success | |||
assert_not_nil assigns(:changeset) | |||
assert_equal "1", assigns(:changeset).revision | |||
assert_select 'h2', :text => 'Revision 1' | |||
end | |||
def test_revision_should_show_add_related_issue_form | |||
@@ -188,7 +179,6 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
def test_revision_with_before_nil_and_afer_normal | |||
get :revision, {:id => 1, :rev => 1} | |||
assert_response :success | |||
assert_template 'revision' | |||
assert_select 'div.contextual' do | |||
assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/0', 0 | |||
@@ -201,7 +191,6 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
assert_difference 'Changeset.find(103).issues.size' do | |||
xhr :post, :add_related_issue, :id => 1, :rev => 4, :issue_id => 2, :format => 'js' | |||
assert_response :success | |||
assert_template 'add_related_issue' | |||
assert_equal 'text/javascript', response.content_type | |||
end | |||
assert_equal [2], Changeset.find(103).issue_ids | |||
@@ -222,7 +211,6 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
assert_no_difference 'Changeset.find(103).issues.size' do | |||
xhr :post, :add_related_issue, :id => 1, :rev => 4, :issue_id => 9999, :format => 'js' | |||
assert_response :success | |||
assert_template 'add_related_issue' | |||
assert_equal 'text/javascript', response.content_type | |||
end | |||
assert_include 'alert("Issue is invalid")', response.body | |||
@@ -236,7 +224,6 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
assert_difference 'Changeset.find(103).issues.size', -1 do | |||
xhr :delete, :remove_related_issue, :id => 1, :rev => 4, :issue_id => 2, :format => 'js' | |||
assert_response :success | |||
assert_template 'remove_related_issue' | |||
assert_equal 'text/javascript', response.content_type | |||
end | |||
assert_equal [1], Changeset.find(103).issue_ids | |||
@@ -273,7 +260,6 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
get :committers, :id => 10 | |||
assert_response :success | |||
assert_template 'committers' | |||
assert_select 'input[value=dlopper] + select option[value="3"][selected=selected]', :text => 'Dave Lopper' | |||
assert_select 'input[value=foo] + select option[selected=selected]', 0 # no option selected | |||
@@ -285,7 +271,6 @@ class RepositoriesControllerTest < Redmine::ControllerTest | |||
get :committers, :id => 10 | |||
assert_response :success | |||
assert_template 'committers' | |||
end | |||
def test_post_committers |
@@ -48,9 +48,10 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
@project.repository.destroy | |||
get :new, :project_id => 'subproject1', :repository_scm => 'Cvs' | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Cvs, assigns(:repository) | |||
assert assigns(:repository).new_record? | |||
assert_select 'select[name=?]', 'repository_scm' do | |||
assert_select 'option[value=?][selected=selected]', 'Cvs' | |||
end | |||
end | |||
def test_browse_root | |||
@@ -60,18 +61,16 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal 3, assigns(:entries).size | |||
entry = assigns(:entries).detect {|e| e.name == 'images'} | |||
assert_equal 'dir', entry.kind | |||
entry = assigns(:entries).detect {|e| e.name == 'README'} | |||
assert_equal 'file', entry.kind | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 3 | |||
assert_select 'tr.dir td.filename a', :text => 'images' | |||
assert_select 'tr.file td.filename a', :text => 'README' | |||
end | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr' | |||
end | |||
end | |||
def test_browse_directory | |||
@@ -81,13 +80,13 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['add.png', 'delete.png', 'edit.png'], assigns(:entries).collect(&:name) | |||
entry = assigns(:entries).detect {|e| e.name == 'edit.png'} | |||
assert_not_nil entry | |||
assert_equal 'file', entry.kind | |||
assert_equal 'images/edit.png', entry.path | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 3 | |||
assert_select 'tr.file td.filename a', :text => 'add.png' | |||
assert_select 'tr.file td.filename a', :text => 'delete.png' | |||
assert_select 'tr.file td.filename a', :text => 'edit.png' | |||
end | |||
end | |||
def test_browse_at_given_revision | |||
@@ -98,9 +97,12 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param], | |||
:rev => 1 | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name) | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 2 | |||
assert_select 'tr.file td.filename a', :text => 'delete.png' | |||
assert_select 'tr.file td.filename a', :text => 'edit.png' | |||
end | |||
end | |||
def test_entry | |||
@@ -111,7 +113,7 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |||
assert_response :success | |||
assert_template 'entry' | |||
assert_select 'td.line-code', :text => /before_filter/, :count => 0 | |||
end | |||
@@ -125,7 +127,7 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param], | |||
:rev => 2 | |||
assert_response :success | |||
assert_template 'entry' | |||
# this line was removed in r3 | |||
assert_select 'td.line-code', :text => /before_filter/ | |||
end | |||
@@ -159,9 +161,7 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entry) | |||
assert_equal 'sources', assigns(:entry).name | |||
assert_select 'table.entries tbody' | |||
end | |||
def test_diff | |||
@@ -172,7 +172,7 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
['inline', 'sbs'].each do |dt| | |||
get :diff, :id => PRJ_ID, :rev => 3, :type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
assert_select 'td.line-code.diff_out', :text => /before_filter :require_login/ | |||
assert_select 'td.line-code.diff_in', :text => /with one change/ | |||
end | |||
@@ -186,7 +186,7 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
['inline', 'sbs'].each do |dt| | |||
get :diff, :id => PRJ_ID, :rev => 1, :type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
assert_select 'td.line-code.diff_in', :text => /watched.remove_watcher/ | |||
assert_select 'th.filename', :text => /test\/README/ | |||
assert_select 'th.filename', :text => /test\/images\/delete.png/ | |||
@@ -203,7 +203,6 @@ class RepositoriesCvsControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
# 1.1 line | |||
assert_select 'tr' do |
@@ -44,9 +44,9 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest | |||
@project.repository.destroy | |||
get :new, :project_id => 'subproject1', :repository_scm => 'Darcs' | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Darcs, assigns(:repository) | |||
assert assigns(:repository).new_record? | |||
assert_select 'select[name=?]', 'repository_scm' do | |||
assert_select 'option[value=?][selected=selected]', 'Darcs' | |||
end | |||
end | |||
def test_browse_root | |||
@@ -55,13 +55,12 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest | |||
@project.reload | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal 3, assigns(:entries).size | |||
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 == 'README' && e.kind == 'file'} | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 3 | |||
assert_select 'tr.dir td.filename a', :text => 'images' | |||
assert_select 'tr.dir td.filename a', :text => 'sources' | |||
assert_select 'tr.file td.filename a', :text => 'README' | |||
end | |||
end | |||
def test_browse_directory | |||
@@ -71,13 +70,11 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name) | |||
entry = assigns(:entries).detect {|e| e.name == 'edit.png'} | |||
assert_not_nil entry | |||
assert_equal 'file', entry.kind | |||
assert_equal 'images/edit.png', entry.path | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 2 | |||
assert_select 'tr.file td.filename a', :text => 'delete.png' | |||
assert_select 'tr.file td.filename a', :text => 'edit.png' | |||
end | |||
end | |||
def test_browse_at_given_revision | |||
@@ -88,9 +85,10 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param], | |||
:rev => 1 | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['delete.png'], assigns(:entries).collect(&:name) | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 1 | |||
assert_select 'tr.file td.filename a', :text => 'delete.png' | |||
end | |||
end | |||
def test_changes | |||
@@ -101,7 +99,6 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest | |||
get :changes, :id => PRJ_ID, | |||
:path => repository_path_hash(['images', 'edit.png'])[:param] | |||
assert_response :success | |||
assert_template 'changes' | |||
assert_select 'h2', :text => /edit.png/ | |||
end | |||
@@ -114,7 +111,6 @@ class RepositoriesDarcsControllerTest < Redmine::ControllerTest | |||
['inline', 'sbs'].each do |dt| | |||
get :diff, :id => PRJ_ID, :rev => 5, :type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
# Line 22 removed | |||
assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/ | |||
end |
@@ -45,9 +45,9 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest | |||
@project.repository.destroy | |||
get :new, :project_id => 'subproject1', :repository_scm => 'Filesystem' | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Filesystem, assigns(:repository) | |||
assert assigns(:repository).new_record? | |||
assert_select 'select[name=?]', 'repository_scm' do | |||
assert_select 'option[value=?][selected=selected]', 'Filesystem' | |||
end | |||
end | |||
def test_browse_root | |||
@@ -55,11 +55,15 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest | |||
@repository.reload | |||
get :show, :id => PRJ_ID | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert assigns(:entries).size > 0 | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size == 0 | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 3 | |||
assert_select 'tr.dir td.filename a', :text => 'dir' | |||
assert_select 'tr.dir td.filename a', :text => 'japanese' | |||
assert_select 'tr.file td.filename a', :text => 'test' | |||
end | |||
assert_select 'table.changesets tbody', 0 | |||
assert_select 'input[name=rev]', 0 | |||
assert_select 'a', :text => 'Statistics', :count => 0 | |||
@@ -69,7 +73,6 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest | |||
def test_show_no_extension | |||
get :entry, :id => PRJ_ID, :path => repository_path_hash(['test'])[:param] | |||
assert_response :success | |||
assert_template 'entry' | |||
assert_select 'tr#L1 td.line-code', :text => /TEST CAT/ | |||
end | |||
@@ -84,7 +87,6 @@ class RepositoriesFilesystemControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['japanese', 'euc-jp.txt'])[:param] | |||
assert_response :success | |||
assert_template 'entry' | |||
assert_select 'tr#L2 td.line-code', :text => /japanese/ | |||
if @ruby19_non_utf8_pass | |||
puts "TODO: show repository file contents test fails " + |
@@ -94,9 +94,9 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
@project.repository.destroy | |||
get :new, :project_id => 'subproject1', :repository_scm => 'Git' | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Git, assigns(:repository) | |||
assert assigns(:repository).new_record? | |||
assert_select 'select[name=?]', 'repository_scm' do | |||
assert_select 'option[value=?][selected=selected]', 'Git' | |||
end | |||
end | |||
def test_browse_root | |||
@@ -107,20 +107,23 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
get :show, :id => PRJ_ID | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal 9, assigns(:entries).size | |||
assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'} | |||
assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && 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 == 'copied_README' && e.kind == 'file'} | |||
assert assigns(:entries).detect {|e| e.name == 'new_file.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 == ' filename with a leading space.txt ' && e.kind == 'file'} | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 9 | |||
assert_select 'tr.dir td.filename_no_report a', :text => 'images' | |||
assert_select 'tr.dir td.filename_no_report a', :text => 'this_is_a_really_long_and_verbose_directory_name' | |||
assert_select 'tr.dir td.filename_no_report a', :text => 'sources' | |||
assert_select 'tr.file td.filename_no_report a', :text => 'README' | |||
assert_select 'tr.file td.filename_no_report a', :text => 'copied_README' | |||
assert_select 'tr.file td.filename_no_report a', :text => 'new_file.txt' | |||
assert_select 'tr.file td.filename_no_report a', :text => 'renamed_test.txt' | |||
assert_select 'tr.file td.filename_no_report a', :text => 'filemane with spaces.txt' | |||
assert_select 'tr.file td.filename_no_report a', :text => 'filename with a leading space.txt' | |||
end | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr' | |||
end | |||
end | |||
def test_browse_branch | |||
@@ -130,15 +133,18 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID, :rev => 'test_branch' | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal 4, assigns(:entries).size | |||
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 == 'README' && e.kind == 'file'} | |||
assert assigns(:entries).detect {|e| e.name == 'test.txt' && e.kind == 'file'} | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 4 | |||
assert_select 'tr.dir td.filename_no_report a', :text => 'images' | |||
assert_select 'tr.dir td.filename_no_report a', :text => 'sources' | |||
assert_select 'tr.file td.filename_no_report a', :text => 'README' | |||
assert_select 'tr.file td.filename_no_report a', :text => 'test.txt' | |||
end | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr' | |||
end | |||
end | |||
def test_browse_tag | |||
@@ -152,11 +158,9 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
].each do |t1| | |||
get :show, :id => PRJ_ID, :rev => t1 | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert assigns(:entries).size > 0 | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody tr' | |||
assert_select 'table.changesets tbody tr' | |||
end | |||
end | |||
@@ -167,15 +171,12 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['edit.png'], assigns(:entries).collect(&:name) | |||
entry = assigns(:entries).detect {|e| e.name == 'edit.png'} | |||
assert_not_nil entry | |||
assert_equal 'file', entry.kind | |||
assert_equal 'images/edit.png', entry.path | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 1 | |||
assert_select 'tr.file td.filename_no_report a', :text => 'edit.png' | |||
end | |||
assert_select 'table.changesets tbody tr' | |||
end | |||
def test_browse_at_given_revision | |||
@@ -186,18 +187,17 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param], | |||
: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) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 1 | |||
assert_select 'tr.file td.filename_no_report a', :text => 'delete.png' | |||
end | |||
end | |||
def test_changes | |||
get :changes, :id => PRJ_ID, | |||
:path => repository_path_hash(['images', 'edit.png'])[:param] | |||
assert_response :success | |||
assert_template 'changes' | |||
assert_select 'h2', :text => /edit.png/ | |||
end | |||
@@ -205,7 +205,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |||
assert_response :success | |||
assert_template 'entry' | |||
# Line 11 | |||
assert_select 'tr#L11 td.line-code', :text => /WITHOUT ANY WARRANTY/ | |||
end | |||
@@ -224,7 +223,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['latin-1-dir', "test-#{CHAR_1_HEX}.txt"])[:param], | |||
:rev => r1 | |||
assert_response :success | |||
assert_template 'entry' | |||
assert_select 'tr#L1 td.line-code', :text => /test-#{CHAR_1_HEX}.txt/ | |||
end | |||
end | |||
@@ -244,9 +242,8 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entry) | |||
assert_equal 'sources', assigns(:entry).name | |||
assert_select 'h2 a', :text => 'sources' | |||
assert_select 'table.entries tbody' | |||
end | |||
def test_diff | |||
@@ -263,7 +260,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7', | |||
:type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
# Line 22 removed | |||
assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/ | |||
assert_select 'h2', :text => /2f9c0091/ | |||
@@ -284,7 +280,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param], | |||
:type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
# Line 22 removed | |||
assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/ | |||
assert_select 'h2', :text => /2f9c0091/ | |||
@@ -330,9 +325,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
:rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7', | |||
:type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
diff = assigns(:diff) | |||
assert_not_nil diff | |||
assert_select 'h2', :text => /2f9c0091:61b685fb/ | |||
assert_select 'form[action=?]', '/projects/subproject1/repository/revisions/61b685fbe55ab05b5ac68402d5720c1a6ac973d1/diff' | |||
assert_select 'input#rev_to[type=hidden][name=rev_to][value=?]', '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' | |||
@@ -356,9 +348,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
:rev_to => '2f9c0091c754a91a', | |||
:type => 'inline' | |||
assert_response :success | |||
assert_template 'diff' | |||
diff = assigns(:diff) | |||
assert_not_nil diff | |||
assert_select 'form[action=?]', '/projects/subproject1/repository/test-diff-path/revisions/61b685fbe55ab05b/diff' | |||
assert_select 'input#rev_to[type=hidden][name=rev_to][value=?]', '2f9c0091c754a91a' | |||
end | |||
@@ -372,7 +361,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
['inline', 'sbs'].each do |dt| | |||
get :diff, :id => PRJ_ID, :rev => r1, :type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
assert_select 'table' do | |||
assert_select 'thead th.filename', :text => /latin-1-dir\/test-#{CHAR_1_HEX}.txt/ | |||
assert_select 'tbody td.diff_in', :text => /test-#{CHAR_1_HEX}.txt/ | |||
@@ -386,7 +374,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
def test_diff_should_show_filenames | |||
get :diff, :id => PRJ_ID, :rev => 'deff712f05a90d96edbd70facc47d944be5897e3', :type => 'inline' | |||
assert_response :success | |||
assert_template 'diff' | |||
# modified file | |||
assert_select 'th.filename', :text => 'sources/watchers_controller.rb' | |||
# deleted file | |||
@@ -405,7 +392,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
:id => PRJ_ID, | |||
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' | |||
assert_response :success | |||
assert_template 'diff' | |||
user.reload | |||
assert_equal "inline", user.pref[:diff_type] | |||
get :diff, | |||
@@ -413,7 +399,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7', | |||
:type => 'sbs' | |||
assert_response :success | |||
assert_template 'diff' | |||
user.reload | |||
assert_equal "sbs", user.pref[:diff_type] | |||
end | |||
@@ -422,7 +407,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
# Line 23, changeset 2f9c0091 | |||
assert_select 'tr' do | |||
@@ -441,7 +425,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, :rev => 'deff7', | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
assert_select 'h2', :text => /@ deff712f/ | |||
end | |||
@@ -449,7 +432,7 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
with_settings :default_language => 'en' do | |||
get :annotate, :id => PRJ_ID, | |||
:path => repository_path_hash(['images', 'edit.png'])[:param] | |||
assert_response 200 | |||
assert_response :success | |||
assert_select 'p#errorExplanation', :text => /cannot be annotated/ | |||
end | |||
end | |||
@@ -459,14 +442,13 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param], | |||
:rev => 'deff712f' | |||
assert_response 200 | |||
assert_response :success | |||
assert_select 'p#errorExplanation', :text => /exceeds the maximum text file size/ | |||
get :annotate, :id => PRJ_ID, | |||
:path => repository_path_hash(['README'])[:param], | |||
:rev => '7234cb2' | |||
assert_response :success | |||
assert_template 'annotate' | |||
end | |||
end | |||
@@ -520,8 +502,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
@project.reload | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :revisions, :id => PRJ_ID | |||
assert_response :success | |||
assert_template 'revisions' | |||
assert_select 'form[method=get][action=?]', '/projects/subproject1/repository/revision' | |||
end | |||
@@ -533,7 +513,6 @@ class RepositoriesGitControllerTest < Redmine::ControllerTest | |||
['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r| | |||
get :revision, :id => PRJ_ID, :rev => r | |||
assert_response :success | |||
assert_template 'revision' | |||
end | |||
end | |||
@@ -58,9 +58,9 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
@project.repository.destroy | |||
get :new, :project_id => 'subproject1', :repository_scm => 'Mercurial' | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Mercurial, assigns(:repository) | |||
assert assigns(:repository).new_record? | |||
assert_select 'select[name=?]', 'repository_scm' do | |||
assert_select 'option[value=?][selected=selected]', 'Mercurial' | |||
end | |||
end | |||
def test_show_root | |||
@@ -70,14 +70,18 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal 4, assigns(:entries).size | |||
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 == 'README' && e.kind == 'file'} | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 4 | |||
assert_select 'tr.dir td.filename a', :text => 'images' | |||
assert_select 'tr.dir td.filename a', :text => 'sources' | |||
assert_select 'tr.file td.filename a', :text => '.hgtags' | |||
assert_select 'tr.file td.filename a', :text => 'README' | |||
end | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr' | |||
end | |||
end | |||
def test_show_directory | |||
@@ -87,15 +91,16 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name) | |||
entry = assigns(:entries).detect {|e| e.name == 'edit.png'} | |||
assert_not_nil entry | |||
assert_equal 'file', entry.kind | |||
assert_equal 'images/edit.png', entry.path | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 2 | |||
assert_select 'tr.file td.filename a', :text => 'delete.png' | |||
assert_select 'tr.file td.filename a', :text => 'edit.png' | |||
end | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr' | |||
end | |||
end | |||
def test_show_at_given_revision | |||
@@ -107,11 +112,15 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param], | |||
:rev => r1 | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['delete.png'], assigns(:entries).collect(&:name) | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 1 | |||
assert_select 'tr.file td.filename a', :text => 'delete.png' | |||
end | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr' | |||
end | |||
end | |||
end | |||
@@ -125,15 +134,19 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['sql_escape', 'percent%dir'])[:param], | |||
:rev => r1 | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ['percent%file1.txt', 'percentfile1.txt'], | |||
assigns(:entries).collect(&:name) | |||
changesets = assigns(:changesets) | |||
assert_not_nil changesets | |||
assert assigns(:changesets).size > 0 | |||
assert_equal %w(13 11 10 9), changesets.collect(&:revision) | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 2 | |||
assert_select 'tr.file td.filename a', :text => 'percent%file1.txt' | |||
assert_select 'tr.file td.filename a', :text => 'percentfile1.txt' | |||
end | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr td.id a', :text => /^13:/ | |||
assert_select 'tr td.id a', :text => /^11:/ | |||
assert_select 'tr td.id a', :text => /^10:/ | |||
assert_select 'tr td.id a', :text => /^9:/ | |||
end | |||
end | |||
end | |||
@@ -147,16 +160,22 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['latin-1-dir'])[:param], | |||
:rev => r1 | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_equal ["make-latin-1-file.rb", | |||
"test-#{@char_1}-1.txt", | |||
"test-#{@char_1}-2.txt", | |||
"test-#{@char_1}.txt"], assigns(:entries).collect(&:name) | |||
changesets = assigns(:changesets) | |||
assert_not_nil changesets | |||
assert_equal %w(21 20 19 18 17), changesets.collect(&:revision) | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 4 | |||
assert_select 'tr.file td.filename a', :text => "make-latin-1-file.rb" | |||
assert_select 'tr.file td.filename a', :text => "test-#{@char_1}-1.txt" | |||
assert_select 'tr.file td.filename a', :text => "test-#{@char_1}-2.txt" | |||
assert_select 'tr.file td.filename a', :text => "test-#{@char_1}.txt" | |||
end | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr td.id a', :text => /^21:/ | |||
assert_select 'tr td.id a', :text => /^20:/ | |||
assert_select 'tr td.id a', :text => /^19:/ | |||
assert_select 'tr td.id a', :text => /^18:/ | |||
assert_select 'tr td.id a', :text => /^17:/ | |||
end | |||
end | |||
end | |||
@@ -186,11 +205,9 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
].each do |bra| | |||
get :show, :id => PRJ_ID, :rev => bra | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert assigns(:entries).size > 0 | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody tr' | |||
assert_select 'table.changesets tbody tr' | |||
end | |||
end | |||
@@ -206,11 +223,9 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
].each do |tag| | |||
get :show, :id => PRJ_ID, :rev => tag | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert assigns(:entries).size > 0 | |||
assert_not_nil assigns(:changesets) | |||
assert assigns(:changesets).size > 0 | |||
assert_select 'table.entries tbody tr' | |||
assert_select 'table.changesets tbody tr' | |||
end | |||
end | |||
@@ -218,7 +233,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
get :changes, :id => PRJ_ID, | |||
:path => repository_path_hash(['images', 'edit.png'])[:param] | |||
assert_response :success | |||
assert_template 'changes' | |||
assert_select 'h2', :text => /edit.png/ | |||
end | |||
@@ -226,7 +240,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |||
assert_response :success | |||
assert_template 'entry' | |||
# Line 10 | |||
assert_select 'tr#L10 td.line-code', :text => /WITHOUT ANY WARRANTY/ | |||
end | |||
@@ -237,7 +250,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param], | |||
:rev => r1 | |||
assert_response :success | |||
assert_template 'entry' | |||
assert_select 'tr#L1 td.line-code', :text => /Mercurial is a distributed version control system/ | |||
end | |||
end | |||
@@ -249,7 +261,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param], | |||
:rev => r1 | |||
assert_response :success | |||
assert_template 'entry' | |||
assert_select 'tr#L1 td.line-code', :text => /test-#{@char_1}.txt/ | |||
end | |||
end | |||
@@ -272,9 +283,8 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entry) | |||
assert_equal 'sources', assigns(:entry).name | |||
assert_select 'h2 a', :text => 'sources' | |||
assert_select 'table.entries tbody' | |||
end | |||
def test_diff | |||
@@ -287,7 +297,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
['inline', 'sbs'].each do |dt| | |||
get :diff, :id => PRJ_ID, :rev => r1, :type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
if @diff_c_support | |||
# Line 22 removed | |||
assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/ | |||
@@ -311,9 +320,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
:rev_to => r2, | |||
:type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
diff = assigns(:diff) | |||
assert_not_nil diff | |||
assert_select 'h2', :text => /4:def6d2f1254a 2:400bb8672109/ | |||
end | |||
end | |||
@@ -326,7 +332,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
['inline', 'sbs'].each do |dt| | |||
get :diff, :id => PRJ_ID, :rev => r1, :type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
assert_select 'table' do | |||
assert_select 'thead th.filename', :text => /latin-1-dir\/test-#{@char_1}-2.txt/ | |||
assert_select 'tbody td.diff_in', :text => /It is written in Python/ | |||
@@ -339,14 +344,12 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
def test_diff_should_show_modified_filenames | |||
get :diff, :id => PRJ_ID, :rev => '400bb8672109', :type => 'inline' | |||
assert_response :success | |||
assert_template 'diff' | |||
assert_select 'th.filename', :text => 'sources/watchers_controller.rb' | |||
end | |||
def test_diff_should_show_deleted_filenames | |||
get :diff, :id => PRJ_ID, :rev => 'b3a615152df8', :type => 'inline' | |||
assert_response :success | |||
assert_template 'diff' | |||
assert_select 'th.filename', :text => 'sources/welcome_controller.rb' | |||
end | |||
@@ -354,7 +357,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
# Line 22, revision 4:def6d2f1254a | |||
assert_select 'tr' do | |||
@@ -385,7 +387,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, :rev => r1, | |||
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
assert_select 'h2', :text => /@ 2:400bb8672109/ | |||
end | |||
end | |||
@@ -396,7 +397,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param], | |||
:rev => r1 | |||
assert_response :success | |||
assert_template 'annotate' | |||
assert_select "th.line-num", :text => '1' do | |||
assert_select "+ td.revision" do | |||
assert_select "a", :text => '20:709858aafd1b' | |||
@@ -429,7 +429,6 @@ class RepositoriesMercurialControllerTest < Redmine::ControllerTest | |||
with_settings :default_language => "en" do | |||
get :revision, :id => PRJ_ID, :rev => r | |||
assert_response :success | |||
assert_template 'revision' | |||
assert_select 'title', | |||
:text => 'Revision 1:9d5b5b004199 - Added 2 files and modified one. - eCookbook Subproject 1 - Redmine' | |||
end |
@@ -43,9 +43,9 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
@project.repository.destroy | |||
get :new, :project_id => 'subproject1', :repository_scm => 'Subversion' | |||
assert_response :success | |||
assert_template 'new' | |||
assert_kind_of Repository::Subversion, assigns(:repository) | |||
assert assigns(:repository).new_record? | |||
assert_select 'select[name=?]', 'repository_scm' do | |||
assert_select 'option[value=?][selected=selected]', 'Subversion' | |||
end | |||
end | |||
def test_show | |||
@@ -55,14 +55,17 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entries) | |||
assert_not_nil assigns(:changesets) | |||
entry = assigns(:entries).detect {|e| e.name == 'subversion_test'} | |||
assert_not_nil entry | |||
assert_equal 'dir', entry.kind | |||
assert_select 'tr.dir a[href="/projects/subproject1/repository/show/subversion_test"]' | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 1 | |||
assert_select 'tr.dir td.filename a', :text => 'subversion_test' | |||
assert_select 'tr.dir td.filename a[href=?]', '/projects/subproject1/repository/show/subversion_test' | |||
end | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr', 10 | |||
assert_select 'tr td.id a', :text => '11' | |||
end | |||
assert_select 'input[name=rev]' | |||
assert_select 'a', :text => 'Statistics' | |||
@@ -77,7 +80,7 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :show, :id => PRJ_ID, :repository_id => 'svn' | |||
assert_response :success | |||
assert_template 'show' | |||
assert_select 'tr.dir a[href="/projects/subproject1/repository/svn/show/subversion_test"]' | |||
# Repository menu should link to the main repo | |||
assert_select '#main-menu a[href="/projects/subproject1/repository"]' | |||
@@ -90,16 +93,16 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
assert_equal NUM_REV, @repository.changesets.count | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['subversion_test'])[:param] | |||
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) | |||
entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'} | |||
assert_equal 'file', entry.kind | |||
assert_equal 'subversion_test/helloworld.c', entry.path | |||
assert_select 'table.entries tbody' do | |||
assert_select 'tr', 5 | |||
assert_select 'tr.dir td.filename a', :text => '[folder_with_brackets]' | |||
assert_select 'tr.dir td.filename a', :text => 'folder' | |||
assert_select 'tr.file td.filename a', :text => '.project' | |||
assert_select 'tr.file td.filename a', :text => 'helloworld.c' | |||
assert_select 'tr.file td.filename a', :text => 'textfile.txt' | |||
end | |||
assert_select 'a.text-x-c', :text => 'helloworld.c' | |||
end | |||
@@ -111,10 +114,15 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :show, :id => PRJ_ID, :path => repository_path_hash(['subversion_test'])[:param], | |||
:rev => 4 | |||
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_select 'table.entries tbody' do | |||
assert_select 'tr', 5 | |||
assert_select 'tr.dir td.filename a', :text => 'folder' | |||
assert_select 'tr.file td.filename a', :text => '.project' | |||
assert_select 'tr.file td.filename a', :text => 'helloworld.c' | |||
assert_select 'tr.file td.filename a', :text => 'helloworld.rb' | |||
assert_select 'tr.file td.filename a', :text => 'textfile.txt' | |||
end | |||
end | |||
def test_file_changes | |||
@@ -125,16 +133,16 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :changes, :id => PRJ_ID, | |||
:path => repository_path_hash(['subversion_test', 'folder', 'helloworld.rb'])[:param] | |||
assert_response :success | |||
assert_template 'changes' | |||
changesets = assigns(:changesets) | |||
assert_not_nil changesets | |||
assert_equal %w(6 3 2), changesets.collect(&:revision) | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr', 3 | |||
assert_select 'tr td.id a', :text => '6' | |||
assert_select 'tr td.id a', :text => '3' | |||
assert_select 'tr td.id a', :text => '2' | |||
end | |||
# svn properties displayed with svn >= 1.5 only | |||
if Redmine::Scm::Adapters::SubversionAdapter.client_version_above?([1, 5, 0]) | |||
assert_not_nil assigns(:properties) | |||
assert_equal 'native', assigns(:properties)['svn:eol-style'] | |||
assert_select 'ul li' do | |||
assert_select 'b', :text => 'svn:eol-style' | |||
assert_select 'span', :text => 'native' | |||
@@ -150,11 +158,16 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :changes, :id => PRJ_ID, | |||
:path => repository_path_hash(['subversion_test', 'folder'])[:param] | |||
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) | |||
assert_select 'table.changesets tbody' do | |||
assert_select 'tr', 6 | |||
assert_select 'tr td.id a', :text => '10' | |||
assert_select 'tr td.id a', :text => '9' | |||
assert_select 'tr td.id a', :text => '7' | |||
assert_select 'tr td.id a', :text => '6' | |||
assert_select 'tr td.id a', :text => '5' | |||
assert_select 'tr td.id a', :text => '2' | |||
end | |||
end | |||
def test_entry | |||
@@ -165,7 +178,8 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] | |||
assert_response :success | |||
assert_template 'entry' | |||
assert_select 'h2 a', :text => 'subversion_test' | |||
assert_select 'h2 a', :text => 'helloworld.c' | |||
end | |||
def test_entry_should_show_other_if_too_big | |||
@@ -187,7 +201,7 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'rubylogo.gif'])[:param] | |||
assert_response :success | |||
assert_template 'entry' | |||
assert_select 'img[src=?]', '/projects/subproject1/repository/raw/subversion_test/folder/subfolder/rubylogo.gif' | |||
end | |||
def test_entry_at_given_revision | |||
@@ -199,7 +213,6 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['subversion_test', 'helloworld.rb'])[:param], | |||
:rev => 2 | |||
assert_response :success | |||
assert_template 'entry' | |||
# this line was removed in r3 and file was moved in r6 | |||
assert_select 'td.line-code', :text => /Here's the code/ | |||
end | |||
@@ -233,16 +246,14 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :entry, :id => PRJ_ID, | |||
:path => repository_path_hash(['subversion_test', 'folder'])[:param] | |||
assert_response :success | |||
assert_template 'show' | |||
assert_not_nil assigns(:entry) | |||
assert_equal 'folder', assigns(:entry).name | |||
assert_select 'h2 a', :text => 'subversion_test' | |||
assert_select 'h2 a', :text => 'folder' | |||
end | |||
# TODO: this test needs fixtures. | |||
def test_revision | |||
get :revision, :id => 1, :rev => 2 | |||
assert_response :success | |||
assert_template 'revision' | |||
assert_select 'ul' do | |||
assert_select 'li' do | |||
@@ -290,7 +301,6 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :revision, :id => 1, :rev => 2 | |||
assert_response :success | |||
assert_template 'revision' | |||
assert_select 'ul' do | |||
assert_select 'li' do | |||
@@ -310,7 +320,6 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
['inline', 'sbs'].each do |dt| | |||
get :diff, :id => PRJ_ID, :rev => 3, :type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
assert_select 'h2', :text => /Revision 3/ | |||
assert_select 'th.filename', :text => 'subversion_test/textfile.txt' | |||
end | |||
@@ -338,13 +347,12 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
:path => repository_path_hash(['subversion_test', 'folder'])[:param], | |||
:type => dt | |||
assert_response :success | |||
assert_template 'diff' | |||
diff = assigns(:diff) | |||
assert_not_nil diff | |||
# 2 files modified | |||
assert_equal 2, Redmine::UnifiedDiff.new(diff).size | |||
assert_select 'h2', :text => /2:6/ | |||
# 2 files modified | |||
assert_select 'table.filecontent', 2 | |||
assert_select 'table.filecontent thead th.filename', :text => 'greeter.rb' | |||
assert_select 'table.filecontent thead th.filename', :text => 'helloworld.rb' | |||
end | |||
end | |||
@@ -356,7 +364,6 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, | |||
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
assert_select 'tr' do | |||
assert_select 'th.line-num', :text => '1' | |||
@@ -380,7 +387,6 @@ class RepositoriesSubversionControllerTest < Redmine::ControllerTest | |||
get :annotate, :id => PRJ_ID, :rev => 8, | |||
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] | |||
assert_response :success | |||
assert_template 'annotate' | |||
assert_select 'h2', :text => /@ 8/ | |||
end | |||