From e9772896312c0250b5f29172c8f573cabfdb597f Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Fri, 3 May 2024 10:42:47 +1200 Subject: [PATCH] Use `Console::CapturedOutput` everywhere. --- fixtures/console/captured_output.rb | 4 +++- test/console.rb | 12 ++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/fixtures/console/captured_output.rb b/fixtures/console/captured_output.rb index f22a4ba..b5a4276 100644 --- a/fixtures/console/captured_output.rb +++ b/fixtures/console/captured_output.rb @@ -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 diff --git a/test/console.rb b/test/console.rb index 58fdd25..855e88a 100644 --- a/test/console.rb +++ b/test/console.rb @@ -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 @@ -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|