webhook_spec.rb 691 B

12345678910111213141516171819202122232425262728293031323334
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Webhook do
  4. let(:webhook) { Fabricate(:webhook) }
  5. describe '#rotate_secret!' do
  6. it 'changes the secret' do
  7. previous_value = webhook.secret
  8. webhook.rotate_secret!
  9. expect(webhook.secret).to_not be_blank
  10. expect(webhook.secret).to_not eq previous_value
  11. end
  12. end
  13. describe '#enable!' do
  14. before do
  15. webhook.disable!
  16. end
  17. it 'enables the webhook' do
  18. webhook.enable!
  19. expect(webhook.enabled?).to be true
  20. end
  21. end
  22. describe '#disable!' do
  23. it 'disables the webhook' do
  24. webhook.disable!
  25. expect(webhook.enabled?).to be false
  26. end
  27. end
  28. end