diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2018-12-12 13:25:37 +1100 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2018-12-13 14:22:09 +1100 |
commit | adcdea2a732c6cdf3281281b69579c0aad9c6bf4 (patch) | |
tree | c3db905b0890895303b2f1ca91f3ac02664ce48a | |
parent | 18824bd30d23b26f36331dedeb390c5b4fac7184 (diff) | |
download | gitlab-shell-sh-bump-ruby-version.tar.gz |
More accurate expaction around warning outputsh-bump-ruby-version
-rw-r--r-- | lib/gitlab_logger.rb | 3 | ||||
-rw-r--r-- | spec/gitlab_logger_spec.rb | 6 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 |
3 files changed, 2 insertions, 9 deletions
diff --git a/lib/gitlab_logger.rb b/lib/gitlab_logger.rb index 2eaeac7..edb8b05 100644 --- a/lib/gitlab_logger.rb +++ b/lib/gitlab_logger.rb @@ -7,8 +7,7 @@ require_relative 'gitlab_config' def convert_log_level(log_level) Logger.const_get(log_level.upcase) rescue NameError - warn "WARNING: Unrecognized log level #{log_level.inspect}." - warn "WARNING: Falling back to INFO." + warn "WARNING: Unrecognized log level #{log_level.inspect}. Falling back to INFO." Logger::INFO end diff --git a/spec/gitlab_logger_spec.rb b/spec/gitlab_logger_spec.rb index b0ec792..d5704c3 100644 --- a/spec/gitlab_logger_spec.rb +++ b/spec/gitlab_logger_spec.rb @@ -8,11 +8,7 @@ describe :convert_log_level do end it "converts invalid log level to Logger::INFO" do - case CURRENT_RUBY_VERSION - when '2.5' - expect(Warning).to receive(:warn).at_least(:once) - end - + expect { convert_log_level(:extreme) }.to output(/WARNING: Unrecognized log level :extreme. Falling back to INFO./).to_stderr expect(convert_log_level(:extreme)).to eq(Logger::INFO) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e3aca4e..dfdf449 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,8 +4,6 @@ SimpleCov.start require 'gitlab_init' -CURRENT_RUBY_VERSION = "#{RbConfig::CONFIG['MAJOR']}.#{RbConfig::CONFIG['MINOR']}" - Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f } RSpec.configure do |config| |