diff --git a/lib/console/event/failure.rb b/lib/console/event/failure.rb index eb3d80e..f23505b 100644 --- a/lib/console/event/failure.rb +++ b/lib/console/event/failure.rb @@ -27,7 +27,9 @@ def self.for(exception) def self.log(subject, exception, **options) Console.error(subject, **self.for(exception).to_hash, **options) end - + + attr_reader :exception + def initialize(exception, root = Dir.getwd) @exception = exception @root = root diff --git a/test/console/event/failure.rb b/test/console/event/failure.rb index 666a07b..814fa00 100644 --- a/test/console/event/failure.rb +++ b/test/console/event/failure.rb @@ -53,5 +53,11 @@ def detailed_message(...) ) ) end + + it "can get #exception" do + failure = Console::Event::Failure.for(error) + + expect(failure.exception).to be == error + end end end