diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-12 00:10:00 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-12 00:10:00 +0000 |
commit | 81373fe07e0afe94e4d63a37c51a80c10132aeac (patch) | |
tree | 6f8fcfd6422d8416a9b292bef4fb03d9a3c7dd32 /spec/rubocop/code_reuse_helpers_spec.rb | |
parent | 68b6fd7fb2edaaae86a4ee8df02b7f9783672050 (diff) | |
download | gitlab-ce-81373fe07e0afe94e4d63a37c51a80c10132aeac.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop/code_reuse_helpers_spec.rb')
-rw-r--r-- | spec/rubocop/code_reuse_helpers_spec.rb | 75 |
1 files changed, 4 insertions, 71 deletions
diff --git a/spec/rubocop/code_reuse_helpers_spec.rb b/spec/rubocop/code_reuse_helpers_spec.rb index 695c152e3db..9337df368e3 100644 --- a/spec/rubocop/code_reuse_helpers_spec.rb +++ b/spec/rubocop/code_reuse_helpers_spec.rb @@ -150,31 +150,6 @@ RSpec.describe RuboCop::CodeReuseHelpers do end end - describe '#in_graphql_types?' do - %w[ - app/graphql/types - ee/app/graphql/ee/types - ee/app/graphql/types - ].each do |path| - it "returns true for a node in #{path}" do - node = build_and_parse_source('10', rails_root_join(path, 'foo.rb')) - - expect(cop.in_graphql_types?(node)).to eq(true) - end - end - - %w[ - app/graphql/resolvers - app/foo - ].each do |path| - it "returns true for a node in #{path}" do - node = build_and_parse_source('10', rails_root_join(path, 'foo.rb')) - - expect(cop.in_graphql_types?(node)).to eq(false) - end - end - end - describe '#in_api?' do it 'returns true for a node in the API directory' do node = build_and_parse_source('10', rails_root_join('lib', 'api', 'foo.rb')) @@ -189,67 +164,25 @@ RSpec.describe RuboCop::CodeReuseHelpers do end end - describe '#in_spec?' do - it 'returns true for a node in the spec directory' do - node = build_and_parse_source('10', rails_root_join('spec', 'foo.rb')) - - expect(cop.in_spec?(node)).to eq(true) - end - - it 'returns true for a node in the ee/spec directory' do - node = build_and_parse_source('10', rails_root_join('ee', 'spec', 'foo.rb')) - - expect(cop.in_spec?(node)).to eq(true) - end - - it 'returns false for a node outside the spec directory' do - node = build_and_parse_source('10', rails_root_join('lib', 'foo.rb')) - - expect(cop.in_spec?(node)).to eq(false) - end - end - - describe '#in_app_directory?' do + describe '#in_directory?' do it 'returns true for a directory in the CE app/ directory' do node = build_and_parse_source('10', rails_root_join('app', 'models', 'foo.rb')) - expect(cop.in_app_directory?(node, 'models')).to eq(true) + expect(cop.in_directory?(node, 'models')).to eq(true) end it 'returns true for a directory in the EE app/ directory' do node = build_and_parse_source('10', rails_root_join('ee', 'app', 'models', 'foo.rb')) - expect(cop.in_app_directory?(node, 'models')).to eq(true) + expect(cop.in_directory?(node, 'models')).to eq(true) end it 'returns false for a directory in the lib/ directory' do node = build_and_parse_source('10', rails_root_join('lib', 'models', 'foo.rb')) - expect(cop.in_app_directory?(node, 'models')).to eq(false) - end - end - - describe '#in_lib_directory?' do - it 'returns true for a directory in the CE lib/ directory' do - node = build_and_parse_source('10', rails_root_join('lib', 'models', 'foo.rb')) - - expect(cop.in_lib_directory?(node, 'models')).to eq(true) - end - - it 'returns true for a directory in the EE lib/ directory' do - node = - build_and_parse_source('10', rails_root_join('ee', 'lib', 'models', 'foo.rb')) - - expect(cop.in_lib_directory?(node, 'models')).to eq(true) - end - - it 'returns false for a directory in the app/ directory' do - node = - build_and_parse_source('10', rails_root_join('app', 'models', 'foo.rb')) - - expect(cop.in_lib_directory?(node, 'models')).to eq(false) + expect(cop.in_directory?(node, 'models')).to eq(false) end end |