Convert admin/account_actions spec controller->system (#34207)
				
					
				
			This commit is contained in:
		@@ -1,35 +0,0 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe Admin::AccountActionsController do
 | 
			
		||||
  render_views
 | 
			
		||||
 | 
			
		||||
  let(:user) { Fabricate(:admin_user) }
 | 
			
		||||
 | 
			
		||||
  before do
 | 
			
		||||
    sign_in user, scope: :user
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'GET #new' do
 | 
			
		||||
    let(:account) { Fabricate(:account) }
 | 
			
		||||
 | 
			
		||||
    it 'returns http success' do
 | 
			
		||||
      get :new, params: { account_id: account.id }
 | 
			
		||||
 | 
			
		||||
      expect(response).to have_http_status(:success)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'POST #create' do
 | 
			
		||||
    let(:account) { Fabricate(:account) }
 | 
			
		||||
 | 
			
		||||
    it 'records the account action' do
 | 
			
		||||
      expect do
 | 
			
		||||
        post :create, params: { account_id: account.id, admin_account_action: { type: 'silence' } }
 | 
			
		||||
      end.to change { account.strikes.count }.by(1)
 | 
			
		||||
 | 
			
		||||
      expect(response).to redirect_to(admin_account_path(account.id))
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										29
									
								
								spec/system/admin/account_actions_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								spec/system/admin/account_actions_spec.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe 'Admin Account Actions' do
 | 
			
		||||
  let(:user) { Fabricate(:admin_user) }
 | 
			
		||||
 | 
			
		||||
  before { sign_in user }
 | 
			
		||||
 | 
			
		||||
  describe 'Creating a new account action on an account' do
 | 
			
		||||
    let(:account) { Fabricate(:account) }
 | 
			
		||||
 | 
			
		||||
    it 'creates the action and redirects to the account page' do
 | 
			
		||||
      visit new_admin_account_action_path(account_id: account.id)
 | 
			
		||||
      expect(page)
 | 
			
		||||
        .to have_title(I18n.t('admin.account_actions.title', acct: account.pretty_acct))
 | 
			
		||||
 | 
			
		||||
      choose(option: 'silence')
 | 
			
		||||
      expect { submit_form }
 | 
			
		||||
        .to change { account.strikes.count }.by(1)
 | 
			
		||||
      expect(page)
 | 
			
		||||
        .to have_title(account.pretty_acct)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def submit_form
 | 
			
		||||
      click_on I18n.t('admin.account_actions.action')
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user