discourse/spec/support/fake_logger.rb
dependabot[bot] c4812948f6
Build(deps-dev): Bump rspec-rails from 5.1.2 to 6.0.0 (#18534)
* Build(deps-dev): Bump rspec-rails from 5.1.2 to 6.0.0

Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 5.1.2 to 6.0.0.
- [Release notes](https://github.com/rspec/rspec-rails/releases)
- [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v5.1.2...v6.0.0)

---
updated-dependencies:
- dependency-name: rspec-rails
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* FIX: Set the default level of FakeLogger

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2022-10-12 20:25:49 +02:00

59 lines
787 B
Ruby

# frozen_string_literal: true
class FakeLogger
attr_reader :debug, :infos, :warnings, :errors, :fatals
attr_accessor :level
def initialize
@debug = []
@infos = []
@warnings = []
@errors = []
@fatals = []
@level = Logger::DEBUG
end
def debug(message)
@debug << message
end
def debug?
@level <= Logger::DEBUG
end
def info(message = nil)
@infos << message
end
def info?
@level <= Logger::INFO
end
def warn(message)
@warnings << message
end
def warn?
@level <= Logger::WARN
end
def error(message)
@errors << message
end
def error?
@level <= Logger::ERROR
end
def fatal(message)
@fatals << message
end
def fatal?
@level <= Logger::FATAL
end
def formatter
end
end