# Pull Request Template ## Description - Validates openai key while configuring hooks - added backfill logic Fixes # (issue) ## Type of change - [x] New feature (non-breaking change which adds functionality) ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. locally <img width="1710" height="1234" alt="CleanShot 2026-04-15 at 16 15 02@2x" src="https://github.com/user-attachments/assets/3d319fe0-19f9-4fd0-9308-74987daac2e1" /> <img width="2884" height="1136" alt="CleanShot 2026-05-11 at 19 22 53@2x" src="https://github.com/user-attachments/assets/5eae8650-985b-4c4a-af42-35f7175ff52d" /> ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
59 lines
2.1 KiB
Ruby
59 lines
2.1 KiB
Ruby
require 'rails_helper'
|
|
require Rails.root.join 'spec/mailers/administrator_notifications/shared/smtp_config_shared.rb'
|
|
|
|
RSpec.describe AdministratorNotifications::IntegrationsNotificationMailer do
|
|
include_context 'with smtp config'
|
|
|
|
let!(:account) { create(:account) }
|
|
let!(:administrator) { create(:user, :administrator, email: 'admin@example.com', account: account) }
|
|
let!(:another_administrator) { create(:user, :administrator, email: 'owner@example.com', account: account) }
|
|
|
|
describe 'slack_disconnect' do
|
|
let(:mail) { described_class.with(account: account).slack_disconnect.deliver_now }
|
|
|
|
it 'renders the subject' do
|
|
expect(mail.subject).to eq('Your Slack integration has expired')
|
|
end
|
|
|
|
it 'renders the receiver email' do
|
|
expect(mail.to).to contain_exactly(administrator.email, another_administrator.email)
|
|
end
|
|
|
|
it 'includes reconnect instructions in the body' do
|
|
expect(mail.body.encoded).to include('To continue receiving messages on Slack, please delete the integration and connect your workspace again')
|
|
end
|
|
end
|
|
|
|
describe 'dialogflow_disconnect' do
|
|
let(:mail) { described_class.with(account: account).dialogflow_disconnect.deliver_now }
|
|
|
|
it 'renders the subject' do
|
|
expect(mail.subject).to eq('Your Dialogflow integration was disconnected')
|
|
end
|
|
|
|
it 'renders the content' do
|
|
expect(mail.body.encoded).to include('Your Dialogflow integration was disconnected because of permission issues')
|
|
end
|
|
|
|
it 'renders the receiver email' do
|
|
expect(mail.to).to contain_exactly(administrator.email, another_administrator.email)
|
|
end
|
|
end
|
|
|
|
describe 'openai_disconnect' do
|
|
let(:mail) { described_class.with(account: account).openai_disconnect.deliver_now }
|
|
|
|
it 'renders the subject' do
|
|
expect(mail.subject).to eq('Your OpenAI integration was disconnected')
|
|
end
|
|
|
|
it 'renders the content' do
|
|
expect(mail.body.encoded).to include('the configured API key is invalid or revoked')
|
|
end
|
|
|
|
it 'renders the receiver email' do
|
|
expect(mail.to).to contain_exactly(administrator.email, another_administrator.email)
|
|
end
|
|
end
|
|
end
|