diff options
Diffstat (limited to 'spec/graphql/mutations/customer_relations/organizations/create_spec.rb')
-rw-r--r-- | spec/graphql/mutations/customer_relations/organizations/create_spec.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/graphql/mutations/customer_relations/organizations/create_spec.rb b/spec/graphql/mutations/customer_relations/organizations/create_spec.rb index ab430b9240b..738a8d724ab 100644 --- a/spec/graphql/mutations/customer_relations/organizations/create_spec.rb +++ b/spec/graphql/mutations/customer_relations/organizations/create_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe Mutations::CustomerRelations::Organizations::Create do let_it_be(:user) { create(:user) } + let_it_be(:group) { create(:group) } let(:valid_params) do attributes_for(:organization, @@ -23,22 +24,19 @@ RSpec.describe Mutations::CustomerRelations::Organizations::Create do end context 'when the user does not have permission' do - let_it_be(:group) { create(:group) } - before do - group.add_guest(user) + group.add_reporter(user) end 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 user has permission' do - let_it_be(:group) { create(:group) } - before_all do - group.add_reporter(user) + group.add_developer(user) end context 'when the feature is disabled' do @@ -48,6 +46,7 @@ RSpec.describe Mutations::CustomerRelations::Organizations::Create do it 'raises an error' do expect { resolve_mutation }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable) + .with_message('Feature disabled') end end |