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
Linting
Oliver Güntherb9832b359a92
diff --git a/modules/documents/spec/controllers/documents_controller_spec.rb b/modules/documents/spec/controllers/documents_controller_spec.rbindex 151ae510c53..597bb515779 100644--- a/modules/documents/spec/controllers/documents_controller_spec.rb+++ b/modules/documents/spec/controllers/documents_controller_spec.rb@@ -69,17 +69,17 @@ describe DocumentsController doget :index, params: { project_id: project.identifier }end- it "should render the index-template successfully" do+ it "renders the index-template successfully" doexpect(response).to be_successfulexpect(response).to render_template("index")end- it "should group documents by category, if no other sorting is given " do+ it "group documents by category, if no other sorting is given" doexpect(assigns(:grouped)).not_to be_nilexpect(assigns(:grouped).keys.map(&:name)).to eql [default_category.name]end- it "should render documents with long descriptions properly" do+ it "renders documents with long descriptions properly" doexpect(response.body).to have_selector('.wiki p', visible: :all)expect(response.body).to have_selector('.wiki p', visible: :all, text: (document.description.split("\n").first + '...'))expect(response.body).to have_selector('.wiki p', visible: :all, text: /EndOfLineHere.../)@@ -98,7 +98,8 @@ describe DocumentsController dodescribe "create" dolet(:document_attributes) do- FactoryBot.attributes_for(:document, title: "New Document",+ FactoryBot.attributes_for(:document,+ title: "New Document",project_id: project.id,category_id: default_category.id)end@@ -107,27 +108,30 @@ describe DocumentsController doActionMailer::Base.deliveries.clearend- it "should create a new document with valid arguments" do- expect do- post :create, params: { project_id: project.identifier,- document: FactoryBot.attributes_for(:document, title: "New Document",- project_id: project.id,- category_id: default_category.id) }- end.to change { Document.count }.by 1- end-- it "should create a new document with valid arguments" do+ it "creates a new document with valid arguments" doexpect dopost :create,params: {project_id: project.identifier,- document: document_attributes+ document: FactoryBot.attributes_for(+ :document,+ title: "New Document",+ project_id: project.id,+ category_id: default_category.id+ )}- end.to change { Document.count }.by 1+ end.to change(Document, :count).by 1+ end++ it 'does trigger a workflow job for the document' do+ expect(Notifications::WorkflowJob)+ .to have_been_enqueued+ .with(:create_notifications, document.journals.last, true)enddescribe "with attachments" dolet(:uncontainered) { FactoryBot.create :attachment, container: nil, author: admin }+before donotify_project = projectFactoryBot.create(:member, project: notify_project, user: user, roles: [role])@@ -135,14 +139,15 @@ describe DocumentsController dopost :create,params: {project_id: notify_project.identifier,- document: FactoryBot.attributes_for(:document, title: "New Document",+ document: FactoryBot.attributes_for(:document,+ title: "New Document",project_id: notify_project.id,category_id: default_category.id),attachments: { '1' => { id: uncontainered.id } }}end- it "should add an attachment" do+ it "adds an attachment" dodocument = Document.lastexpect(document.attachments.count).to eql 1@@ -150,7 +155,7 @@ describe DocumentsController doexpect(uncontainered.reload).to eql attachmentend- it "should redirect to the documents-page" do+ it "redirects to the documents-page" doexpect(response).to redirect_to project_documents_path(project.identifier)endend@@ -162,7 +167,7 @@ describe DocumentsController doget :show, params: { id: document.id }end- it "should delete the document and redirect back to documents-page of the project" do+ it "shows the attachment" doexpect(response).to be_successfulexpect(response).to render_template('show')end@@ -187,14 +192,14 @@ describe DocumentsController do}end- it "should add the attachment" do+ it "adds the attachment" doexpect(response).to be_redirectdocument.reloadexpect(document.attachments.length).to eq(1)expect(uncontainered.reload).to eq document.attachments.firstend- it 'should not trigger a mail for the current user' do+ it 'does not trigger a mail for the current user' doexpect(DocumentsMailer).not_to have_received(:attachments_added).with(current_user, *any_args)@@ -213,7 +218,7 @@ describe DocumentsController doit 'does not trigger an attachment job' doexpect(DocumentsMailer).not_to have_received(:attachments_added)- .with(recipient, *any_args)+ .with(recipient, *any_args)endend@@ -229,7 +234,7 @@ describe DocumentsController doit 'does not trigger an attachment job' doexpect(DocumentsMailer).not_to have_received(:attachments_added)- .with(recipient, *any_args)+ .with(recipient, *any_args)endend@@ -257,10 +262,10 @@ describe DocumentsController dodocumentend- it "should delete the document and redirect back to documents-page of the project" do+ it "deletes the document and redirect back to documents-page of the project" doexpect dodelete :destroy, params: { id: document.id }- end.to change { Document.count }.by -1+ end.to change(Document, :count).by -1expect(response).to redirect_to "/projects/#{project.identifier}/documents"expect { Document.find(document.id) }.to raise_error ActiveRecord::RecordNotFounddiff --git a/spec/workers/mails/shared/member_job.rb b/spec/workers/mails/shared/member_job.rbindex a47d9024758..4ea3fac6025 100644--- a/spec/workers/mails/shared/member_job.rb+++ b/spec/workers/mails/shared/member_job.rb@@ -97,7 +97,7 @@ shared_examples 'member job' do%i[added_project updated_global updated_project].each do |mails|allow(MemberMailer).to receive(mails)- .and_return(double('mail', deliver_now: nil))+ .and_return(double('mail', deliver_now: nil)) # rubocop:disable Rspec/VerifiedDoublesendend@@ -143,7 +143,7 @@ shared_examples 'member job' do.with(current_user, member, message)end- context 'and the message is nil' do+ context 'when the message is nil' dolet(:message) { '' }it_behaves_like 'sends no mail'