OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
rubocop
Markus Kahl96e7f858c945
diff --git a/app/models/group_user.rb b/app/models/group_user.rbindex 96b9bc8c1ee..cadad828c54 100644--- a/app/models/group_user.rb+++ b/app/models/group_user.rb@@ -33,6 +33,6 @@ class GroupUser < ApplicationRecordtouch: truebelongs_to :user- validates_presence_of :group- validates_presence_of :user+ validates :group, presence: true+ validates :user, presence: trueenddiff --git a/modules/ldap_groups/spec/services/synchronize_filter_spec.rb b/modules/ldap_groups/spec/services/synchronize_filter_spec.rbindex 4c3176f2e78..8ce7f249a5f 100644--- a/modules/ldap_groups/spec/services/synchronize_filter_spec.rb+++ b/modules/ldap_groups/spec/services/synchronize_filter_spec.rb@@ -28,12 +28,20 @@ describe LdapGroups::SynchronizeFilterService, with_ee: %i[ldap_groups] dolet(:group_bar) { FactoryBot.create :group, lastname: 'bar' }let(:synced_foo) do- FactoryBot.create :ldap_synchronized_group, dn: 'cn=foo,ou=groups,dc=example,dc=com', group: group_foo,- auth_source: auth_source+ FactoryBot.create(+ :ldap_synchronized_group,+ dn: 'cn=foo,ou=groups,dc=example,dc=com',+ group: group_foo,+ auth_source: auth_source+ )endlet(:synced_bar) do- FactoryBot.create :ldap_synchronized_group, dn: 'cn=bar,ou=groups,dc=example,dc=com', group: group_bar,- auth_source: auth_source+ FactoryBot.create(+ :ldap_synchronized_group,+ dn: 'cn=bar,ou=groups,dc=example,dc=com',+ group: group_bar,+ auth_source: auth_source+ )endlet(:filter_foo_bar) { FactoryBot.create :ldap_synchronized_filter, auth_source: auth_source }diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rbindex 2c786338c29..86adcc7891b 100644--- a/spec/models/group_spec.rb+++ b/spec/models/group_spec.rb@@ -73,7 +73,7 @@ describe Group, type: :model dodescribe '#group_users' docontext 'when adding a user' do- context 'which does not exist' do+ context 'if it does not exist' doit 'does not create a group user' docount = group.group_users.countgu = group.group_users.create user_id: User.maximum(:id).to_i + 1diff --git a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rbindex 832d72fd703..00946f95489 100644--- a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb+++ b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb@@ -58,7 +58,7 @@ shared_examples 'it supports direct uploads' dorequest!end- it 'should respond with validation error' do+ it 'responds with a validation error' doexpect(subject.status).to eq(422)end@@ -76,7 +76,7 @@ shared_examples 'it supports direct uploads' dolet(:metadata) { { fileName: 'cat.png' } }let(:json) { JSON.parse subject.body }- it 'should respond with 422 due to missing file size metadata' do+ it 'responds with 422 due to missing file size metadata' doexpect(subject.status).to eq(422)expect(subject.body).to include 'Size'end@@ -89,7 +89,7 @@ shared_examples 'it supports direct uploads' docontext 'with the correct parameters' dolet(:json) { JSON.parse subject.body }- it 'should prepare a direct upload' do+ it 'prepares a direct upload' doexpect(subject.status).to eq 201expect(json["_type"]).to eq "AttachmentUpload"@@ -117,15 +117,15 @@ shared_examples 'it supports direct uploads' doexpect(link).to be_presentend- it 'should point to AWS' do+ it 'points to AWS' doexpect(link["href"]).to eq "https://#{MockCarrierwave.bucket}.s3.amazonaws.com/"end- it 'should have the method POST' do+ it 'has the method POST' doexpect(link["method"]).to eq "post"end- it 'should include form fields' do+ it 'includes form fields' dofields = link["form_fields"]expect(fields).to be_present@@ -140,7 +140,7 @@ shared_examples 'it supports direct uploads' doexpect(fields["key"]).to end_with "cat.png"end- it 'should also include the content type and the necessary policy in the form fields' do+ it 'also includes the content type and the necessary policy in the form fields' dofields = link["form_fields"]expect(fields).to include("policy", "Content-Type")@@ -159,7 +159,7 @@ shared_examples 'it supports direct uploads' docontext 'with an allowed content type' dolet(:metadata) { { fileName: 'cats.csv', fileSize: file.size, contentType: 'text/csv' } }- it 'should succeed' do+ it 'succeeds' doexpect(subject.status).to eq 201endend@@ -167,7 +167,7 @@ shared_examples 'it supports direct uploads' docontext 'with a forbidden content type' dolet(:metadata) { { fileName: 'cats.txt', fileSize: file.size, contentType: 'text/plain' } }- it 'should fail' do+ it 'fails' doexpect(subject.status).to eq 422expect(subject.body).to include "not whitelisted"end@@ -176,8 +176,8 @@ shared_examples 'it supports direct uploads' docontext 'with a non-specific content type not on the whitelist' dolet(:metadata) { { fileName: 'cats.bin', fileSize: file.size, contentType: 'application/binary' } }- # the actual whitelist check will be performed in the FinishDirectUpload job in this case- it 'should still succeed' do+ # the actual whitelist check will be performed in the FinishDirectUpload job in this case+ it 'still succeeds' doexpect(subject.status).to eq 201endend@@ -233,11 +233,11 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :jget get_pathend- it 'should respond with 200' do+ it 'responds with 200' doexpect(subject.status).to eq(200)end- it 'should respond with correct attachment' do+ it 'responds with correct attachment' doexpect(subject.body).to be_json_eql(attachment.filename.to_json).at_path('fileName')end@@ -272,11 +272,11 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :jsubject(:response) { last_response }- it 'should respond with HTTP Created' do+ it 'responds with HTTP Created' doexpect(subject.status).to eq(201)end- it 'should return the new attachment without container' do+ it 'returns the new attachment without container' doexpect(subject.body).to be_json_eql('Attachment'.to_json).at_path('_type')expect(subject.body).to be_json_eql(nil.to_json).at_path('_links/container/href')end@@ -539,7 +539,7 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :jget get_pathend- it 'should respond with 200' do+ it 'responds with 200' doexpect(subject.status).to eq(200)end@@ -558,11 +558,11 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :jpost request_path, request_partsend- it 'should respond with HTTP Created' do+ it 'responds with HTTP Created' doexpect(subject.status).to eq(201)end- it 'should return the new attachment' do+ it 'returns the new attachment' doexpect(subject.body).to be_json_eql('Attachment'.to_json).at_path('_type')end