From a2b0f35a2605bc33d715bf8b0477f862c9cf6602 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 24 Nov 2019 05:25:37 +0000 Subject: [PATCH] cleanup: rubocop: fix Layout/IndentFirstArgument in test/unit/repository_test.rb git-svn-id: http://svn.redmine.org/redmine/trunk@19224 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/repository_test.rb | 174 +++++++++++++++++++++-------------- 1 file changed, 105 insertions(+), 69 deletions(-) diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb index 01007cd38..e78d3a718 100644 --- a/test/unit/repository_test.rb +++ b/test/unit/repository_test.rb @@ -48,11 +48,13 @@ class RepositoryTest < ActiveSupport::TestCase def test_blank_log_encoding_error_message set_language_if_valid 'en' - repo = Repository::Bazaar.new( - :project => Project.find(3), - :url => "/test", - :log_encoding => '' - ) + repo = + Repository::Bazaar. + new( + :project => Project.find(3), + :url => "/test", + :log_encoding => '' + ) assert !repo.save assert_include "Commit messages encoding cannot be blank", repo.errors.full_messages @@ -60,10 +62,12 @@ class RepositoryTest < ActiveSupport::TestCase def test_blank_log_encoding_error_message_fr set_language_if_valid 'fr' - repo = Repository::Bazaar.new( - :project => Project.find(3), - :url => "/test" - ) + repo = + Repository::Bazaar. + new( + :project => Project.find(3), + :url => "/test" + ) assert !repo.save assert_include 'Encodage des messages de commit doit être renseigné(e)', repo.errors.full_messages end @@ -111,19 +115,23 @@ class RepositoryTest < ActiveSupport::TestCase end def test_first_repository_should_be_set_as_default - repository1 = Repository::Subversion.new( - :project => Project.find(3), - :identifier => 'svn1', - :url => 'file:///svn1' - ) + repository1 = + Repository::Subversion. + new( + :project => Project.find(3), + :identifier => 'svn1', + :url => 'file:///svn1' + ) assert repository1.save assert repository1.is_default? - repository2 = Repository::Subversion.new( - :project => Project.find(3), - :identifier => 'svn2', - :url => 'file:///svn2' - ) + repository2 = + Repository::Subversion. + new( + :project => Project.find(3), + :identifier => 'svn2', + :url => 'file:///svn2' + ) assert repository2.save assert !repository2.is_default? @@ -133,20 +141,24 @@ class RepositoryTest < ActiveSupport::TestCase def test_default_repository_should_be_one assert_equal 0, Project.find(3).repositories.count - repository1 = Repository::Subversion.new( - :project => Project.find(3), - :identifier => 'svn1', - :url => 'file:///svn1' - ) + repository1 = + Repository::Subversion. + new( + :project => Project.find(3), + :identifier => 'svn1', + :url => 'file:///svn1' + ) assert repository1.save assert repository1.is_default? - repository2 = Repository::Subversion.new( - :project => Project.find(3), - :identifier => 'svn2', - :url => 'file:///svn2', - :is_default => true - ) + repository2 = + Repository::Subversion. + new( + :project => Project.find(3), + :identifier => 'svn2', + :url => 'file:///svn2', + :is_default => true + ) assert repository2.save assert repository2.is_default? repository1.reload @@ -157,11 +169,13 @@ class RepositoryTest < ActiveSupport::TestCase end def test_identifier_should_accept_letters_digits_dashes_and_underscores - r = Repository::Subversion.new( - :project_id => 3, - :identifier => 'svn-123_45', - :url => 'file:///svn' - ) + r = + Repository::Subversion. + new( + :project_id => 3, + :identifier => 'svn-123_45', + :url => 'file:///svn' + ) assert r.save end @@ -226,8 +240,12 @@ class RepositoryTest < ActiveSupport::TestCase def test_should_not_create_with_disabled_scm # disable Subversion with_settings :enabled_scm => ['Mercurial', 'Git'] do - repository = Repository::Subversion.new( - :project => Project.find(3), :url => "svn://localhost") + repository = + Repository::Subversion. + new( + :project => Project.find(3), + :url => "svn://localhost" + ) assert !repository.save assert_include I18n.translate('activerecord.errors.messages.invalid'), repository.errors[:type] @@ -271,9 +289,11 @@ class RepositoryTest < ActiveSupport::TestCase ActionMailer::Base.deliveries.first(2).each do |mail| assert_not_nil mail assert mail.subject.starts_with?( - "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]") + "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]" + ) assert_mail_body_match( - "Status changed from #{old_status} to #{fixed_issue.status}", mail) + "Status changed from #{old_status} to #{fixed_issue.status}", mail + ) end # ignoring commits referencing an issue of another project @@ -281,9 +301,12 @@ class RepositoryTest < ActiveSupport::TestCase end def test_for_changeset_comments_strip - repository = Repository::Mercurial.create( - :project => Project.find(4), - :url => '/foo/bar/baz' ) + repository = + Repository::Mercurial. + create( + :project => Project.find(4), + :url => '/foo/bar/baz' + ) long_whitespace = " " expected_comment = "This is a loooooooooooooooooooooooooooong comment" comment = +"#{expected_comment}#{long_whitespace}\n" @@ -301,11 +324,14 @@ class RepositoryTest < ActiveSupport::TestCase end def test_for_urls_strip_cvs - repository = Repository::Cvs.create( - :project => Project.find(4), - :url => ' :pserver:login:password@host:/path/to/the/repository', - :root_url => 'foo ', - :log_encoding => 'UTF-8') + repository = + Repository::Cvs. + create( + :project => Project.find(4), + :url => ' :pserver:login:password@host:/path/to/the/repository', + :root_url => 'foo ', + :log_encoding => 'UTF-8' + ) assert repository.save repository.reload assert_equal ':pserver:login:password@host:/path/to/the/repository', @@ -314,18 +340,24 @@ class RepositoryTest < ActiveSupport::TestCase end def test_for_urls_strip_subversion - repository = Repository::Subversion.create( - :project => Project.find(4), - :url => ' file:///dummy ') + repository = + Repository::Subversion. + create( + :project => Project.find(4), + :url => ' file:///dummy ' + ) assert repository.save repository.reload assert_equal 'file:///dummy', repository.url end def test_for_urls_strip_git - repository = Repository::Git.create( - :project => Project.find(4), - :url => ' c:\dummy ') + repository = + Repository::Git. + create( + :project => Project.find(4), + :url => ' c:\dummy ' + ) assert repository.save repository.reload assert_equal 'c:\dummy', repository.url @@ -333,7 +365,8 @@ class RepositoryTest < ActiveSupport::TestCase def test_manual_user_mapping assert_no_difference "Changeset.where('user_id <> 2').count" do - c = Changeset.create!( + c = Changeset. + create!( :repository => @repository, :committer => 'foo', :committed_on => Time.now, @@ -344,7 +377,8 @@ class RepositoryTest < ActiveSupport::TestCase @repository.committer_ids = {'foo' => '2'} assert_equal User.find(2), c.reload.user # committer is now mapped - c = Changeset.create!( + c = Changeset. + create!( :repository => @repository, :committer => 'foo', :committed_on => Time.now, @@ -356,24 +390,26 @@ class RepositoryTest < ActiveSupport::TestCase end def test_auto_user_mapping_by_username - c = Changeset.create!( - :repository => @repository, - :committer => 'jsmith', - :committed_on => Time.now, - :revision => 100, - :comments => 'Committed by john.' - ) + c = Changeset. + create!( + :repository => @repository, + :committer => 'jsmith', + :committed_on => Time.now, + :revision => 100, + :comments => 'Committed by john.' + ) assert_equal User.find(2), c.user end def test_auto_user_mapping_by_email - c = Changeset.create!( - :repository => @repository, - :committer => 'john ', - :committed_on => Time.now, - :revision => 100, - :comments => 'Committed by john.' - ) + c = Changeset. + create!( + :repository => @repository, + :committer => 'john ', + :committed_on => Time.now, + :revision => 100, + :comments => 'Committed by john.' + ) assert_equal User.find(2), c.user end -- 2.39.5