diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-29 18:10:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-29 18:10:35 +0300 |
commit | 6407b5a4c13e34323d50ac3a39fda74e54d09306 (patch) | |
tree | 1461aebeda6e0b5359283a41381f780ab639f821 /spec/rubocop | |
parent | 1a8b381312dc666a93c1bc3879ad15b1350de300 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop')
-rw-r--r-- | spec/rubocop/cop/rspec/feature_category_on_shared_examples_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/rubocop/cop/rspec/feature_category_on_shared_examples_spec.rb b/spec/rubocop/cop/rspec/feature_category_on_shared_examples_spec.rb new file mode 100644 index 00000000000..6b337471f0a --- /dev/null +++ b/spec/rubocop/cop/rspec/feature_category_on_shared_examples_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'rubocop_spec_helper' +require 'rspec-parameterized' + +require_relative '../../../../rubocop/cop/rspec/feature_category_on_shared_examples' + +RSpec.describe RuboCop::Cop::RSpec::FeatureCategoryOnSharedExamples, feature_category: :tooling do + it 'flags feature category in shared example' do + expect_offense(<<~RUBY) + RSpec.shared_examples 'foo', feature_category: :shared do + ^^^^^^^^^^^^^^^^^^^^^^^^^ Shared examples should not have feature category set + end + + shared_examples 'foo', feature_category: :shared do + ^^^^^^^^^^^^^^^^^^^^^^^^^ Shared examples should not have feature category set + end + RUBY + end + + it 'does not flag if feature category is missing' do + expect_no_offenses(<<~RUBY) + RSpec.shared_examples 'foo' do + end + + shared_examples 'foo', some: :tag do + end + RUBY + end +end |