webhook_spec.rb 674 B

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