Skip to content

Commit

Permalink
Doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
reidmorrison committed Sep 5, 2024
1 parent 5530cf6 commit 9837e6b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,25 @@ assert_semantic_logger_event(
)
~~~

### RSpec

For RSpec users, this sample supplied by @jgascoignetaylor-godaddy will be useful:
~~~ruby
context 'when it blows up' do
let(:capture_logger) { SemanticLogger::Test::CaptureLogEvents.new }

it 'should should log the error' do
allow_any_instance_of(MyThing).to receive(:logger).and_return(capture_logger)
MyThing.new('asdf').do_something!

expect(capture_logger.events.last.message).to include('Here is a message')
expect(capture_logger.events.last.level).to eq(:error)
end
end
~~~

Open to pull requests to implement the RSpec equivalent of the Minitest helpers: `SemanticLogger::Test::Minitest`.

### Other testing frameworks

If you use another testing framework and would like to contribute helper methods similar
Expand Down

1 comment on commit 9837e6b

@ixti
Copy link
Contributor

@ixti ixti commented on 9837e6b Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've come to a solution to avoid stubbing logger: #297 :D

Please sign in to comment.