Skip to content

Commit

Permalink
Merge 9859ad1 into edebbb3
Browse files Browse the repository at this point in the history
  • Loading branch information
amyspark committed May 5, 2020
2 parents edebbb3 + 9859ad1 commit f578dd7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/tty/logger.rb
Expand Up @@ -69,6 +69,13 @@ def self.configure
yield config
end

# Instance logger configuration
#
# @api public
def configure
yield @config
end

# Create a logger instance
#
# @example
Expand Down
9 changes: 9 additions & 0 deletions spec/unit/config_spec.rb
Expand Up @@ -73,6 +73,15 @@
})
end

it "yields logger's own configuration" do
logger = TTY::Logger.new(output: output)
config = double(:configure)
allow(logger).to receive(:configure).and_yield(config)
expect { |block|
logger.configure(&block)
}.to yield_with_args(config)
end

it "yields configuration instance" do
config = double(:config)
allow(TTY::Logger).to receive(:config).and_return(config)
Expand Down

0 comments on commit f578dd7

Please sign in to comment.