diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-11 15:08:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-11 15:08:50 +0300 |
commit | 0eaa82ad61d2fda42b2dd5cf58cc08654b2d69ef (patch) | |
tree | 9ab5c60316dd689e0ac53830fd3910817006c9b3 /spec/rubocop/cop/gitlab | |
parent | 6b5f961bef87c70effe57b14d41f9ed882b5d296 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop/cop/gitlab')
-rw-r--r-- | spec/rubocop/cop/gitlab/rails_logger_spec.rb | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/spec/rubocop/cop/gitlab/rails_logger_spec.rb b/spec/rubocop/cop/gitlab/rails_logger_spec.rb index 0583079136b..70d208b31ec 100644 --- a/spec/rubocop/cop/gitlab/rails_logger_spec.rb +++ b/spec/rubocop/cop/gitlab/rails_logger_spec.rb @@ -10,22 +10,12 @@ RSpec.describe RuboCop::Cop::Gitlab::RailsLogger, type: :rubocop do subject(:cop) { described_class.new } - it 'flags the use of Rails.logger.error with a constant receiver' do - inspect_source("Rails.logger.error('some error')") + described_class::LOG_METHODS.each do |method| + it "flags the use of Rails.logger.#{method} with a constant receiver" do + inspect_source("Rails.logger.#{method}('some error')") - expect(cop.offenses.size).to eq(1) - end - - it 'flags the use of Rails.logger.info with a constant receiver' do - inspect_source("Rails.logger.info('some info')") - - expect(cop.offenses.size).to eq(1) - end - - it 'flags the use of Rails.logger.warn with a constant receiver' do - inspect_source("Rails.logger.warn('some warning')") - - expect(cop.offenses.size).to eq(1) + expect(cop.offenses.size).to eq(1) + end end it 'does not flag the use of Rails.logger with a constant that is not Rails' do @@ -39,4 +29,10 @@ RSpec.describe RuboCop::Cop::Gitlab::RailsLogger, type: :rubocop do expect(cop.offenses.size).to eq(0) end + + it 'does not flag the use of Rails.logger.level' do + inspect_source("Rails.logger.level") + + expect(cop.offenses.size).to eq(0) + end end |