From 604e1c2b11419c6208c0479522434dc64d4fa5e6 Mon Sep 17 00:00:00 2001
From: Matt Jankowski <matt@jankowski.online>
Date: Mon, 15 May 2023 14:20:13 -0400
Subject: [PATCH] Remove usage of random sample values in specs (#24869)

---
 spec/controllers/auth/registrations_controller_spec.rb | 2 +-
 spec/fabricators/notification_fabricator.rb            | 2 +-
 spec/mailers/notification_mailer_spec.rb               | 2 +-
 spec/mailers/user_mailer_spec.rb                       | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/spec/controllers/auth/registrations_controller_spec.rb b/spec/controllers/auth/registrations_controller_spec.rb
index 42b2606ad..a80273635 100644
--- a/spec/controllers/auth/registrations_controller_spec.rb
+++ b/spec/controllers/auth/registrations_controller_spec.rb
@@ -97,7 +97,7 @@ RSpec.describe Auth::RegistrationsController do
   end
 
   describe 'POST #create' do
-    let(:accept_language) { Rails.application.config.i18n.available_locales.sample.to_s }
+    let(:accept_language) { 'de' }
 
     before do
       session[:registration_form_time] = 5.seconds.ago
diff --git a/spec/fabricators/notification_fabricator.rb b/spec/fabricators/notification_fabricator.rb
index 959fda913..1e0c80987 100644
--- a/spec/fabricators/notification_fabricator.rb
+++ b/spec/fabricators/notification_fabricator.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
 Fabricator(:notification) do
-  activity fabricator: [:mention, :status, :follow, :follow_request, :favourite].sample
+  activity fabricator: :status
   account
 end
diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb
index 3113d05c3..73c751def 100644
--- a/spec/mailers/notification_mailer_spec.rb
+++ b/spec/mailers/notification_mailer_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe NotificationMailer do
 
   shared_examples 'localized subject' do |*args, **kwrest|
     it 'renders subject localized for the locale of the receiver' do
-      locale = %i(de en).sample
+      locale = :de
       receiver.update!(locale: locale)
       expect(mail.subject).to eq I18n.t(*args, **kwrest.merge(locale: locale))
     end
diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb
index 6144b2bbb..a4f6c145a 100644
--- a/spec/mailers/user_mailer_spec.rb
+++ b/spec/mailers/user_mailer_spec.rb
@@ -7,7 +7,7 @@ describe UserMailer do
 
   shared_examples 'localized subject' do |*args, **kwrest|
     it 'renders subject localized for the locale of the receiver' do
-      locale = I18n.available_locales.sample
+      locale = :de
       receiver.update!(locale: locale)
       expect(mail.subject).to eq I18n.t(*args, **kwrest.merge(locale: locale))
     end