mirror of
https://github.com/redmine/redmine.git
synced 2025-11-08 14:26:04 +01:00
fix source indent of RepositoriesBazaarControllerTest
git-svn-id: http://svn.redmine.org/redmine/trunk@20104 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -33,10 +33,12 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
super
|
super
|
||||||
User.current = nil
|
User.current = nil
|
||||||
@project = Project.find(PRJ_ID)
|
@project = Project.find(PRJ_ID)
|
||||||
@repository = Repository::Bazaar.create(
|
@repository =
|
||||||
|
Repository::Bazaar.create(
|
||||||
:project => @project,
|
:project => @project,
|
||||||
:url => REPOSITORY_PATH_TRUNK,
|
:url => REPOSITORY_PATH_TRUNK,
|
||||||
:log_encoding => 'UTF-8')
|
:log_encoding => 'UTF-8'
|
||||||
|
)
|
||||||
assert @repository
|
assert @repository
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -44,10 +46,13 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
def test_get_new
|
def test_get_new
|
||||||
@request.session[:user_id] = 1
|
@request.session[:user_id] = 1
|
||||||
@project.repository.destroy
|
@project.repository.destroy
|
||||||
get :new, :params => {
|
get(
|
||||||
|
:new,
|
||||||
|
:params => {
|
||||||
:project_id => 'subproject1',
|
:project_id => 'subproject1',
|
||||||
:repository_scm => 'Bazaar'
|
:repository_scm => 'Bazaar'
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'select[name=?]', 'repository_scm' do
|
assert_select 'select[name=?]', 'repository_scm' do
|
||||||
assert_select 'option[value=?][selected=selected]', 'Bazaar'
|
assert_select 'option[value=?][selected=selected]', 'Bazaar'
|
||||||
@@ -55,9 +60,12 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_browse_root
|
def test_browse_root
|
||||||
get :show, :params => {
|
get(
|
||||||
|
:show,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID
|
:id => PRJ_ID
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'table.entries tbody' do
|
assert_select 'table.entries tbody' do
|
||||||
assert_select 'tr', 2
|
assert_select 'tr', 2
|
||||||
@@ -67,11 +75,14 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_browse_directory
|
def test_browse_directory
|
||||||
get :show, :params => {
|
get(
|
||||||
|
:show,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => @repository.id,
|
:repository_id => @repository.id,
|
||||||
:path => repository_path_hash(['directory'])[:param]
|
:path => repository_path_hash(['directory'])[:param]
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'table.entries tbody' do
|
assert_select 'table.entries tbody' do
|
||||||
assert_select 'tr', 3
|
assert_select 'tr', 3
|
||||||
@@ -82,12 +93,15 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_browse_at_given_revision
|
def test_browse_at_given_revision
|
||||||
get :show, :params => {
|
get(
|
||||||
|
:show,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => @repository.id,
|
:repository_id => @repository.id,
|
||||||
:path => repository_path_hash([])[:param],
|
:path => repository_path_hash([])[:param],
|
||||||
:rev => 3
|
:rev => 3
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'table.entries tbody' do
|
assert_select 'table.entries tbody' do
|
||||||
assert_select 'tr', 4
|
assert_select 'tr', 4
|
||||||
@@ -99,44 +113,56 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_changes
|
def test_changes
|
||||||
get :changes, :params => {
|
get(
|
||||||
|
:changes,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => @repository.id,
|
:repository_id => @repository.id,
|
||||||
:path => repository_path_hash(['doc-mkdir.txt'])[:param]
|
:path => repository_path_hash(['doc-mkdir.txt'])[:param]
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'h2', :text => /doc-mkdir.txt/
|
assert_select 'h2', :text => /doc-mkdir.txt/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entry_show
|
def test_entry_show
|
||||||
get :entry, :params => {
|
get(
|
||||||
|
:entry,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => @repository.id,
|
:repository_id => @repository.id,
|
||||||
:path => repository_path_hash(['directory', 'doc-ls.txt'])[:param]
|
:path => repository_path_hash(['directory', 'doc-ls.txt'])[:param]
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
# Line 19
|
# Line 19
|
||||||
assert_select 'tr#L29 td.line-code', :text => /Show help message/
|
assert_select 'tr#L29 td.line-code', :text => /Show help message/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entry_download
|
def test_entry_download
|
||||||
get :entry, :params => {
|
get(
|
||||||
|
:entry,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => @repository.id,
|
:repository_id => @repository.id,
|
||||||
:path => repository_path_hash(['directory', 'doc-ls.txt'])[:param],
|
:path => repository_path_hash(['directory', 'doc-ls.txt'])[:param],
|
||||||
:format => 'raw'
|
:format => 'raw'
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
# File content
|
# File content
|
||||||
assert @response.body.include?('Show help message')
|
assert @response.body.include?('Show help message')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_directory_entry
|
def test_directory_entry
|
||||||
get :entry, :params => {
|
get(
|
||||||
|
:entry,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => @repository.id,
|
:repository_id => @repository.id,
|
||||||
:path => repository_path_hash(['directory'])[:param]
|
:path => repository_path_hash(['directory'])[:param]
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'table.entries tbody'
|
assert_select 'table.entries tbody'
|
||||||
end
|
end
|
||||||
@@ -144,12 +170,15 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
def test_diff
|
def test_diff
|
||||||
# Full diff of changeset 3
|
# Full diff of changeset 3
|
||||||
['inline', 'sbs'].each do |dt|
|
['inline', 'sbs'].each do |dt|
|
||||||
get :diff, :params => {
|
get(
|
||||||
|
:diff,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => @repository.id,
|
:repository_id => @repository.id,
|
||||||
:rev => 3,
|
:rev => 3,
|
||||||
:type => dt
|
:type => dt
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
# Line 11 removed
|
# Line 11 removed
|
||||||
assert_select 'th.line-num:contains(11) ~ td.diff_out', :text => /Display more information/
|
assert_select 'th.line-num:contains(11) ~ td.diff_out', :text => /Display more information/
|
||||||
@@ -157,11 +186,14 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_annotate
|
def test_annotate
|
||||||
get :annotate, :params => {
|
get(
|
||||||
|
:annotate,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => @repository.id,
|
:repository_id => @repository.id,
|
||||||
:path => repository_path_hash(['doc-mkdir.txt'])[:param]
|
:path => repository_path_hash(['doc-mkdir.txt'])[:param]
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
assert_select "th.line-num", :text => '2' do
|
assert_select "th.line-num", :text => '2' do
|
||||||
@@ -176,17 +208,22 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_annotate_author_escaping
|
def test_annotate_author_escaping
|
||||||
repository = Repository::Bazaar.create(
|
repository =
|
||||||
|
Repository::Bazaar.create(
|
||||||
:project => @project,
|
:project => @project,
|
||||||
:url => File.join(REPOSITORY_PATH, "author_escaping"),
|
:url => File.join(REPOSITORY_PATH, "author_escaping"),
|
||||||
:identifier => 'author_escaping',
|
:identifier => 'author_escaping',
|
||||||
:log_encoding => 'UTF-8')
|
:log_encoding => 'UTF-8'
|
||||||
|
)
|
||||||
assert repository
|
assert repository
|
||||||
get :annotate, :params => {
|
get(
|
||||||
|
:annotate,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => 'author_escaping',
|
:repository_id => 'author_escaping',
|
||||||
:path => repository_path_hash(['author-escaping-test.txt'])[:param]
|
:path => repository_path_hash(['author-escaping-test.txt'])[:param]
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
assert_select "th.line-num", :text => '1' do
|
assert_select "th.line-num", :text => '1' do
|
||||||
@@ -207,17 +244,22 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
log_encoding = Encoding.locale_charmap
|
log_encoding = Encoding.locale_charmap
|
||||||
end
|
end
|
||||||
unless log_encoding.nil?
|
unless log_encoding.nil?
|
||||||
repository = Repository::Bazaar.create(
|
repository =
|
||||||
|
Repository::Bazaar.create(
|
||||||
:project => @project,
|
:project => @project,
|
||||||
:url => File.join(REPOSITORY_PATH, "author_non_ascii"),
|
:url => File.join(REPOSITORY_PATH, "author_non_ascii"),
|
||||||
:identifier => 'author_non_ascii',
|
:identifier => 'author_non_ascii',
|
||||||
:log_encoding => log_encoding)
|
:log_encoding => log_encoding
|
||||||
|
)
|
||||||
assert repository
|
assert repository
|
||||||
get :annotate, :params => {
|
get(
|
||||||
|
:annotate,
|
||||||
|
:params => {
|
||||||
:id => PRJ_ID,
|
:id => PRJ_ID,
|
||||||
:repository_id => 'author_non_ascii',
|
:repository_id => 'author_non_ascii',
|
||||||
:path => repository_path_hash(['author-non-ascii-test.txt'])[:param]
|
:path => repository_path_hash(['author-non-ascii-test.txt'])[:param]
|
||||||
}
|
}
|
||||||
|
)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
assert_select "th.line-num", :text => '1' do
|
assert_select "th.line-num", :text => '1' do
|
||||||
@@ -239,9 +281,12 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
assert @repository.changesets.count > 0
|
assert @repository.changesets.count > 0
|
||||||
|
|
||||||
assert_difference 'Repository.count', -1 do
|
assert_difference 'Repository.count', -1 do
|
||||||
delete :destroy, :params => {
|
delete(
|
||||||
|
:destroy,
|
||||||
|
:params => {
|
||||||
:id => @repository.id
|
:id => @repository.id
|
||||||
}
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
assert_response 302
|
assert_response 302
|
||||||
@project.reload
|
@project.reload
|
||||||
@@ -251,18 +296,23 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
|
|||||||
def test_destroy_invalid_repository
|
def test_destroy_invalid_repository
|
||||||
@request.session[:user_id] = 1 # admin
|
@request.session[:user_id] = 1 # admin
|
||||||
@project.repository.destroy
|
@project.repository.destroy
|
||||||
@repository = Repository::Bazaar.create!(
|
@repository =
|
||||||
|
Repository::Bazaar.create!(
|
||||||
:project => @project,
|
:project => @project,
|
||||||
:url => "/invalid",
|
:url => "/invalid",
|
||||||
:log_encoding => 'UTF-8')
|
:log_encoding => 'UTF-8'
|
||||||
|
)
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@repository.reload
|
@repository.reload
|
||||||
assert_equal 0, @repository.changesets.count
|
assert_equal 0, @repository.changesets.count
|
||||||
|
|
||||||
assert_difference 'Repository.count', -1 do
|
assert_difference 'Repository.count', -1 do
|
||||||
delete :destroy, :params => {
|
delete(
|
||||||
|
:destroy,
|
||||||
|
:params => {
|
||||||
:id => @repository.id
|
:id => @repository.id
|
||||||
}
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
assert_response 302
|
assert_response 302
|
||||||
@project.reload
|
@project.reload
|
||||||
|
|||||||
Reference in New Issue
Block a user