mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
feat: APIs for Integration Hooks (#2250)
- Introduces JSON Schema validations via JSONSchemer - Add CRUD APIs for integration hooks
This commit is contained in:
@@ -9,4 +9,22 @@ RSpec.describe Integrations::Hook, type: :model do
|
||||
describe 'associations' do
|
||||
it { is_expected.to belong_to(:account) }
|
||||
end
|
||||
|
||||
describe 'when trying to create multiple hooks for an app' do
|
||||
let(:account) { create(:account) }
|
||||
|
||||
context 'when app allows multiple hooks' do
|
||||
it 'allows to create succesfully' do
|
||||
create(:integrations_hook, account: account, app_id: 'webhook')
|
||||
expect(build(:integrations_hook, account: account, app_id: 'webhook').valid?).to eq true
|
||||
end
|
||||
end
|
||||
|
||||
context 'when app doesnot allow multiple hooks' do
|
||||
it 'throws invalid error' do
|
||||
create(:integrations_hook, account: account, app_id: 'slack')
|
||||
expect(build(:integrations_hook, account: account, app_id: 'slack').valid?).to eq false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user