Commit 92ac5dc3 authored by Max Woolf's avatar Max Woolf

Restructure failing tests

parent b7eb6ed7
......@@ -13,10 +13,6 @@ RSpec.describe 'Delete a compliance framework' do
subject { post_graphql_mutation(mutation, current_user: current_user) }
before do
namespace.add_owner(current_user)
end
def mutation_response
graphql_mutation_response(:destroy_compliance_framework)
end
......@@ -40,6 +36,10 @@ RSpec.describe 'Delete a compliance framework' do
end
context 'current_user is namespace owner' do
before do
namespace.add_owner(current_user)
end
it 'has no errors' do
subject
......@@ -50,14 +50,14 @@ RSpec.describe 'Delete a compliance framework' do
expect { subject }.to change { ComplianceManagement::Framework.count }.by(-1)
end
end
end
context 'current_user is not namespace owner' do
it_behaves_like 'a mutation that returns top-level errors',
errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
context 'current_user is not namespace owner' do
it_behaves_like 'a mutation that returns top-level errors',
errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
it 'does not destroy a compliance framework' do
expect { subject }.not_to change { ComplianceManagement::Framework.count }
it 'does not destroy a compliance framework' do
expect { subject }.not_to change { ComplianceManagement::Framework.count }
end
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