debian-mirror-gitlab/spec/policies/alert_management/alert_policy_spec.rb
2020-08-09 17:41:57 +05:30

25 lines
697 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.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