diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-27 06:09:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-27 06:09:18 +0300 |
commit | 0e1350d51ca2135e37743dfb7af98eae43c72892 (patch) | |
tree | 10a5c3f27cebc539b5b8fe42d4907aec767949b1 /spec/rubocop/cop/graphql | |
parent | 417ef56d244c6c22016fda7c78e69071d14887c3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop/cop/graphql')
-rw-r--r-- | spec/rubocop/cop/graphql/authorize_types_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/rubocop/cop/graphql/authorize_types_spec.rb b/spec/rubocop/cop/graphql/authorize_types_spec.rb index a30cd5a1688..932991c7b76 100644 --- a/spec/rubocop/cop/graphql/authorize_types_spec.rb +++ b/spec/rubocop/cop/graphql/authorize_types_spec.rb @@ -17,6 +17,28 @@ RSpec.describe RuboCop::Cop::Graphql::AuthorizeTypes do TYPE end + it 'adds add an offense when authorize has no arguments' do + expect_offense(<<~TYPE.strip) + module Types + class AType < SuperClassWithFields + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add an `authorize :ability` call to the type: https://docs.gitlab.com/ee/development/graphql_guide/authorization.html#type-authorization + authorize + end + end + TYPE + end + + it 'adds add an offense when authorize is empty' do + expect_offense(<<~TYPE.strip) + module Types + class AType < SuperClassWithFields + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add an `authorize :ability` call to the type: https://docs.gitlab.com/ee/development/graphql_guide/authorization.html#type-authorization + authorize [] + end + end + TYPE + end + it 'does not add an offense for classes that have an authorize call' do expect_no_offenses(<<~TYPE.strip) module Types |