Convert admin/webhooks/secrets spec controller->system (#34109)
				
					
				
			This commit is contained in:
		@@ -1,23 +0,0 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe Admin::Webhooks::SecretsController do
 | 
			
		||||
  render_views
 | 
			
		||||
 | 
			
		||||
  let(:user) { Fabricate(:admin_user) }
 | 
			
		||||
 | 
			
		||||
  before do
 | 
			
		||||
    sign_in user, scope: :user
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'POST #rotate' do
 | 
			
		||||
    let(:webhook) { Fabricate(:webhook) }
 | 
			
		||||
 | 
			
		||||
    it 'returns http success' do
 | 
			
		||||
      post :rotate, params: { webhook_id: webhook.id }
 | 
			
		||||
 | 
			
		||||
      expect(response).to redirect_to(admin_webhook_path(webhook))
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
@@ -85,6 +85,19 @@ RSpec.describe 'Admin Webhooks' do
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    describe 'Rotate a webhook secret' do
 | 
			
		||||
      let!(:webhook) { Fabricate :webhook, events: [Webhook::EVENTS.first] }
 | 
			
		||||
 | 
			
		||||
      it 'rotates secret and returns to page' do
 | 
			
		||||
        visit admin_webhook_path(webhook)
 | 
			
		||||
 | 
			
		||||
        expect { click_on I18n.t('admin.webhooks.rotate_secret') }
 | 
			
		||||
          .to(change { webhook.reload.secret })
 | 
			
		||||
        expect(page)
 | 
			
		||||
          .to have_title(I18n.t('admin.webhooks.title'))
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    describe 'Destroy a webhook' do
 | 
			
		||||
      let!(:webhook) { Fabricate :webhook, events: [Webhook::EVENTS.first] }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user