Commit d4ba84a2 authored by Sean Arnold's avatar Sean Arnold

Add mutation spec and re-word policy spec

parent 98419e98
......@@ -9,6 +9,8 @@ describe Mutations::AlertManagement::UpdateAlertStatus do
let(:new_status) { 'acknowledged' }
let(:args) { { status: new_status, project_path: project.full_path, iid: alert.iid } }
specify { expect(described_class).to require_graphql_authorizations(:update_alert_management_alerts) }
describe '#resolve' do
subject(:resolve) { mutation_for(project, current_user).resolve(args) }
......
......@@ -6,18 +6,20 @@ describe AlertManagement::AlertPolicy, :models do
let(:alert) { create(:alert_management_alert) }
let(:project) { alert.project }
let(:user) { create(:user) }
let(:policy) { described_class.new(user, alert) }
subject(:policy) { described_class.new(user, alert) }
describe 'rules' do
specify { expect(policy).to be_disallowed :read_alert_management_alerts }
it { is_expected.to be_disallowed :read_alert_management_alerts }
it { is_expected.to be_disallowed :update_alert_management_alerts }
context 'when developer' do
before do
project.add_developer(user)
end
specify { expect(policy).to be_allowed :read_alert_management_alerts }
specify { expect(policy).to be_allowed :update_alert_management_alerts }
it { is_expected.to be_allowed :read_alert_management_alerts }
it { is_expected.to be_allowed :update_alert_management_alerts }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment