Enable `aggregate_failures` globally
What does this MR do and why?
This MR enables aggregate_failures
globally by default for all specs except feature specs.
A follow-up issue would ban its use #352555 (closed).
- Issue: #198298
How to set up and validate locally
All specs besides feature specs should aggregate their failures by default.
Feature specs should not aggregate the failures by default, but can still have them aggregated by the developer specifying this as normal.
We can test by applying this patch (exact line numbers might change!):
diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb
index 34eb07d78f1..437a6764050 100644
--- a/spec/features/profile_spec.rb
+++ b/spec/features/profile_spec.rb
@@ -35,8 +35,8 @@
click_button 'Delete account'
end
- expect(page).to have_content('Account scheduled for removal')
- expect(User.exists?(user.id)).to be_falsy
+ expect(page).not_to have_content('Account scheduled for removal')
+ expect(User.exists?(user.id)).not_to be_falsy
end
it 'shows invalid password flash message', :js do
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index f7d32dc1a7b..dc10ea0c749 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -177,9 +177,9 @@
let!(:commit) { note.noteable }
it "is accessible through #noteable" do
- expect(note.commit_id).to eq(commit.id)
- expect(note.noteable).to be_a(Commit)
- expect(note.noteable).to eq(commit)
+ expect(note.commit_id).not_to eq(commit.id)
+ expect(note.noteable).not_to be_a(Commit)
+ expect(note.noteable).not_to eq(commit)
end
it "saves a valid note" do
and running:
bundle exec rspec spec/models/note_spec.rb:179
bundle exec spec/features/profile_spec.rb:29
we can also apply aggregate_failures: false
to the note_spec.rb
example to see we can switch it off.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Luke Duncalfe