Skip to content

Commit

Permalink
Use Console::CapturedOutput everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed May 2, 2024
1 parent d8742fa commit e977289
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 3 additions & 1 deletion fixtures/console/captured_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
# Copyright, 2024, by Samuel Williams.

require 'sus/shared'
require 'console/capture'
require 'console/logger'

module Console
CapturedOutput = Sus::Shared("captured output") do
let(:capture) {Console::Capture.new}
let(:logger) {Console::Logger.new(capture)}
let(:logger) {Console::Logger.new(capture, level: Console::Logger::DEBUG)}

def around
Fiber.new do
Expand Down
12 changes: 2 additions & 10 deletions test/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Copyright, 2020, by Michael Adams.

require 'console'
require 'console/capture'
require 'console/captured_output'

describe Console do
it "has a version number" do
Expand All @@ -20,15 +20,7 @@
end

with 'an isolated logger' do
let(:capture) {Console::Capture.new}
let(:logger) {Console::Logger.new(capture, level: Console::Logger::DEBUG)}

def around
Fiber.new do
Console.logger = logger
super
end.resume
end
include_context Console::CapturedOutput

it "can invoke interface methods for all log levels" do
Console::Logger::LEVELS.each do |name, level|
Expand Down

0 comments on commit e977289

Please sign in to comment.