summaryrefslogtreecommitdiff
path: root/spec/policies/alert_management/alert_policy_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/policies/alert_management/alert_policy_spec.rb')
-rw-r--r--spec/policies/alert_management/alert_policy_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/policies/alert_management/alert_policy_spec.rb b/spec/policies/alert_management/alert_policy_spec.rb
new file mode 100644
index 00000000000..0d7624a0142
--- /dev/null
+++ b/spec/policies/alert_management/alert_policy_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe AlertManagement::AlertPolicy, :models do
+ let(:alert) { create(:alert_management_alert) }
+ let(:project) { alert.project }
+ let(:user) { create(:user) }
+
+ subject(:policy) { described_class.new(user, alert) }
+
+ describe 'rules' do
+ it { is_expected.to be_disallowed :read_alert_management_alert }
+ it { is_expected.to be_disallowed :update_alert_management_alert }
+
+ context 'when developer' do
+ before do
+ project.add_developer(user)
+ end
+
+ it { is_expected.to be_allowed :read_alert_management_alert }
+ it { is_expected.to be_allowed :update_alert_management_alert }
+ end
+ end
+end