Remove final remaining assigns usage in controller specs (#33866)
				
					
				
			This commit is contained in:
		@@ -59,16 +59,15 @@ RSpec.describe Admin::AccountsController do
 | 
			
		||||
      let(:account) { Fabricate(:account) }
 | 
			
		||||
 | 
			
		||||
      it 'includes moderation notes' do
 | 
			
		||||
        note1 = Fabricate(:account_moderation_note, target_account: account)
 | 
			
		||||
        note2 = Fabricate(:account_moderation_note, target_account: account)
 | 
			
		||||
        note1 = Fabricate(:account_moderation_note, target_account: account, content: 'Note 1 remarks')
 | 
			
		||||
        note2 = Fabricate(:account_moderation_note, target_account: account, content: 'Note 2 remarks')
 | 
			
		||||
 | 
			
		||||
        get :show, params: { id: account.id }
 | 
			
		||||
        expect(response).to have_http_status(200)
 | 
			
		||||
 | 
			
		||||
        moderation_notes = assigns(:moderation_notes).to_a
 | 
			
		||||
 | 
			
		||||
        expect(moderation_notes.size).to be 2
 | 
			
		||||
        expect(moderation_notes).to eq [note1, note2]
 | 
			
		||||
        expect(response.body)
 | 
			
		||||
          .to include(note1.content)
 | 
			
		||||
          .and include(note2.content)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -49,23 +49,11 @@ RSpec.describe Admin::InstancesController do
 | 
			
		||||
 | 
			
		||||
      expect(response).to have_http_status(200)
 | 
			
		||||
 | 
			
		||||
      instance = assigns(:instance)
 | 
			
		||||
      expect(instance).to_not be_new_record
 | 
			
		||||
      expect(response.body)
 | 
			
		||||
        .to include(I18n.t('admin.instances.totals_time_period_hint_html'))
 | 
			
		||||
        .and include(I18n.t('accounts.nothing_here'))
 | 
			
		||||
 | 
			
		||||
      expect(Admin::ActionLogFilter).to have_received(:new).with(target_domain: account_popular_main.domain)
 | 
			
		||||
 | 
			
		||||
      action_logs = assigns(:action_logs).to_a
 | 
			
		||||
      expect(action_logs.size).to eq 0
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with an unknown domain' do
 | 
			
		||||
      it 'returns http success' do
 | 
			
		||||
        get :show, params: { id: 'unknown.example' }
 | 
			
		||||
        expect(response).to have_http_status(200)
 | 
			
		||||
 | 
			
		||||
        instance = assigns(:instance)
 | 
			
		||||
        expect(instance).to be_new_record
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								spec/requests/admin/instances_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								spec/requests/admin/instances_spec.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe 'Admin Instances' do
 | 
			
		||||
  describe 'GET /admin/instances/:id' do
 | 
			
		||||
    context 'with an unknown domain' do
 | 
			
		||||
      before { sign_in Fabricate(:admin_user) }
 | 
			
		||||
 | 
			
		||||
      it 'returns http success' do
 | 
			
		||||
        get admin_instance_path(id: 'unknown.example')
 | 
			
		||||
 | 
			
		||||
        expect(response)
 | 
			
		||||
          .to have_http_status(200)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user