From c7dd251afe307a100b6f451b3db04bb5b4442d47 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 24 Nov 2019 05:25:48 +0000 Subject: [PATCH] cleanup: rubocop: fix Layout/IndentFirstHashElement in test/functional/repositories_subversion_controller_test.rb git-svn-id: http://svn.redmine.org/redmine/trunk@19225 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- ...repositories_subversion_controller_test.rb | 131 +++++++++++++----- 1 file changed, 98 insertions(+), 33 deletions(-) diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index f50fec0f5..be40cc70e 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.rb @@ -44,10 +44,13 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest def test_new @request.session[:user_id] = 1 @project.repository.destroy - get :new, :params => { + get( + :new, + :params => { :project_id => 'subproject1', :repository_scm => 'Subversion' } + ) assert_response :success assert_select 'select[name=?]', 'repository_scm' do assert_select 'option[value=?][selected=selected]', 'Subversion' @@ -59,9 +62,12 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :show, :params => { + get( + :show, + :params => { :id => PRJ_ID } + ) assert_response :success assert_select 'table.entries tbody' do @@ -85,11 +91,13 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest Repository::Subversion.create(:project => @project, :url => self.class.subversion_repository_url, :is_default => false, :identifier => 'svn') - - get :show, :params => { + get( + :show, + :params => { :id => PRJ_ID, :repository_id => 'svn' } + ) assert_response :success assert_select 'tr.dir a[href="/projects/subproject1/repository/svn/show/subversion_test"]' @@ -102,11 +110,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :show, :params => { + get( + :show, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test'])[:param] } + ) assert_response :success assert_select 'table.entries tbody' do @@ -126,12 +137,15 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :show, :params => { + get( + :show, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test'])[:param], :rev => 4 } + ) assert_response :success assert_select 'table.entries tbody' do @@ -149,11 +163,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :changes, :params => { + get( + :changes, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'folder', 'helloworld.rb'])[:param] } + ) assert_response :success assert_select 'table.changesets tbody' do @@ -177,11 +194,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :changes, :params => { + get( + :changes, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'folder'])[:param] } + ) assert_response :success assert_select 'table.changesets tbody' do @@ -200,11 +220,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :entry, :params => { + get( + :entry, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } + ) assert_response :success assert_select 'h2 a', :text => 'subversion_test' assert_select 'h2 a', :text => 'helloworld.c' @@ -217,11 +240,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count # no files in the test repo is larger than 1KB... with_settings :file_max_size_displayed => 0 do - get :entry, :params => { + get( + :entry, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } + ) assert_response :success assert_equal 'text/html', @response.content_type assert_select 'p.nodata' @@ -229,11 +255,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest end def test_entry_should_display_images - get :entry, :params => { + get( + :entry, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'rubylogo.gif'])[:param] } + ) assert_response :success assert_select 'img[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/rubylogo.gif" end @@ -243,12 +272,15 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :entry, :params => { + get( + :entry, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.rb'])[:param], :rev => 2 } + ) assert_response :success # this line was removed in r3 and file was moved in r6 assert_select 'td.line-code', :text => /Here's the code/ @@ -259,11 +291,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :entry, :params => { + get( + :entry, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'zzz.c'])[:param] } + ) assert_select 'p#errorExplanation', :text => /The entry or revision was not found in the repository/ end @@ -272,11 +307,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :raw, :params => { + get( + :raw, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } + ) assert_response :success assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition'] end @@ -286,11 +324,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :entry, :params => { + get( + :entry, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'folder'])[:param] } + ) assert_response :success assert_select 'h2 a', :text => 'subversion_test' assert_select 'h2 a', :text => 'folder' @@ -298,11 +339,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest # TODO: this test needs fixtures. def test_revision - get :revision, :params => { + get( + :revision, + :params => { :id => 1, :repository_id => 10, :rev => 2 } + ) assert_response :success assert_select 'ul' do @@ -320,22 +364,28 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :revision, :params => { + get( + :revision, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :rev => 'something_weird' } + ) assert_response 404 assert_select_error /was not found/ end def test_invalid_revision_diff - get :diff, :params => { + get( + :diff, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :rev => '1', :rev_to => 'something_weird' } + ) assert_response 404 assert_select_error /was not found/ end @@ -346,11 +396,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @project.reload assert_equal NUM_REV, @repository.changesets.count ['', ' ', nil].each do |r| - get :revision, :params => { + get( + :revision, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :rev => r } + ) assert_response 404 assert_select_error /was not found/ end @@ -361,12 +414,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest r = Project.find(1).repository # Changes repository url to a subdirectory r.update_attribute :url, (r.url + '/test/some') - - get :revision, :params => { + get( + :revision, + :params => { :id => 1, :repository_id => 10, :rev => 2 } + ) assert_response :success assert_select 'ul' do @@ -385,12 +440,15 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @project.reload assert_equal NUM_REV, @repository.changesets.count ['inline', 'sbs'].each do |dt| - get :diff, :params => { + get( + :diff, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :rev => 3, :type => dt } + ) assert_response :success assert_select 'h2', :text => /Revision 3/ assert_select 'th.filename', :text => 'subversion_test/textfile.txt' @@ -402,13 +460,15 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - - get :diff, :params => { + get( + :diff, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :rev => 5, :format => 'diff' } + ) assert_response :success assert_equal 'text/x-patch', @response.content_type assert_equal 'Index: subversion_test/folder/greeter.rb', @response.body.split(/\r?\n/).first @@ -420,7 +480,9 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @project.reload assert_equal NUM_REV, @repository.changesets.count ['inline', 'sbs'].each do |dt| - get :diff, :params => { + get( + :diff, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :rev => 6, @@ -428,6 +490,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest :path => repository_path_hash(['subversion_test', 'folder'])[:param], :type => dt } + ) assert_response :success assert_select 'h2', :text => /2:6/ @@ -443,11 +506,14 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :annotate, :params => { + get( + :annotate, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } + ) assert_response :success assert_select 'tr' do @@ -469,12 +535,15 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - get :annotate, :params => { + get( + :annotate, + :params => { :id => PRJ_ID, :repository_id => @repository.id, :rev => 8, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } + ) assert_response :success assert_select 'h2', :text => /@ 8/ end @@ -486,9 +555,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count assert_difference 'Repository.count', -1 do - delete :destroy, :params => { - :id => @repository.id - } + delete(:destroy, :params => {:id => @repository.id}) end assert_response 302 @project.reload @@ -505,9 +572,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal 0, @repository.changesets.count assert_difference 'Repository.count', -1 do - delete :destroy, :params => { - :id => @repository.id - } + delete(:destroy, :params => {:id => @repository.id}) end assert_response 302 @project.reload -- 2.39.5