Remove usage of random sample values in specs (#24869)
This commit is contained in:
		
							parent
							
								
									540b446f77
								
							
						
					
					
						commit
						74c77c5274
					
				
					 4 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue