You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
705 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Webhook, type: :model 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