summaryrefslogtreecommitdiff
path: root/spec/rubocop
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-27 03:09:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-27 03:09:18 +0000
commit0e1350d51ca2135e37743dfb7af98eae43c72892 (patch)
tree10a5c3f27cebc539b5b8fe42d4907aec767949b1 /spec/rubocop
parent417ef56d244c6c22016fda7c78e69071d14887c3 (diff)
downloadgitlab-ce-0e1350d51ca2135e37743dfb7af98eae43c72892.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop')
-rw-r--r--spec/rubocop/cop/gitlab/mark_used_feature_flags_spec.rb5
-rw-r--r--spec/rubocop/cop/graphql/authorize_types_spec.rb22
2 files changed, 27 insertions, 0 deletions
diff --git a/spec/rubocop/cop/gitlab/mark_used_feature_flags_spec.rb b/spec/rubocop/cop/gitlab/mark_used_feature_flags_spec.rb
index 9d550d9c56e..96ff01108c3 100644
--- a/spec/rubocop/cop/gitlab/mark_used_feature_flags_spec.rb
+++ b/spec/rubocop/cop/gitlab/mark_used_feature_flags_spec.rb
@@ -201,6 +201,11 @@ RSpec.describe RuboCop::Cop::Gitlab::MarkUsedFeatureFlags do
include_examples 'does not set any flags as used', 'data_consistency :delayed'
end
+ describe 'Class with included WorkerAttributes `data_consistency` method' do
+ include_examples 'sets flag as used', 'ActionMailer::MailDeliveryJob.data_consistency :delayed, feature_flag: :foo', 'foo'
+ include_examples 'does not set any flags as used', 'data_consistency :delayed'
+ end
+
describe 'Worker `deduplicate` method' do
include_examples 'sets flag as used', 'deduplicate :delayed, feature_flag: :foo', 'foo'
include_examples 'does not set any flags as used', 'deduplicate :delayed'
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