summaryrefslogtreecommitdiff
path: root/spec/graphql/mutations/customer_relations/contacts/create_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/graphql/mutations/customer_relations/contacts/create_spec.rb')
-rw-r--r--spec/graphql/mutations/customer_relations/contacts/create_spec.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/graphql/mutations/customer_relations/contacts/create_spec.rb b/spec/graphql/mutations/customer_relations/contacts/create_spec.rb
index 0f05504d4f2..d17d11305b1 100644
--- a/spec/graphql/mutations/customer_relations/contacts/create_spec.rb
+++ b/spec/graphql/mutations/customer_relations/contacts/create_spec.rb
@@ -4,8 +4,8 @@ require 'spec_helper'
RSpec.describe Mutations::CustomerRelations::Contacts::Create do
let_it_be(:user) { create(:user) }
- let_it_be(:group) { create(:group) }
+ let(:group) { create(:group, :crm_enabled) }
let(:not_found_or_does_not_belong) { 'The specified organization was not found or does not belong to this group' }
let(:valid_params) do
attributes_for(:contact,
@@ -34,11 +34,11 @@ RSpec.describe Mutations::CustomerRelations::Contacts::Create do
end
context 'when the user has permission' do
- before_all do
+ before do
group.add_developer(user)
end
- context 'when the feature is disabled' do
+ context 'when the feature flag is disabled' do
before do
stub_feature_flags(customer_relations: false)
end
@@ -49,6 +49,15 @@ RSpec.describe Mutations::CustomerRelations::Contacts::Create do
end
end
+ context 'when crm_enabled is false' do
+ let(:group) { create(:group) }
+
+ it 'raises an error' do
+ expect { resolve_mutation }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable)
+ .with_message("The resource that you are attempting to access does not exist or you don't have permission to perform this action")
+ end
+ end
+
context 'when the params are invalid' do
it 'returns the validation error' do
valid_params[:first_name] = nil