"output" name collission with RSpec::Matchers::BuiltIn::Output

I’m following along in The RSpec Book on page 43

The book is careful to specify all the version of the gems it uses. My problem is likely I am using current gems.

The code I downloaded looks like this

You are correct. rspec added the ability to test that some code has written something to stdout. You use it like this:

expect { print(‘foo’) }.to output(‘foo’).to_stdout

To make this work, rspec defines an output method (that returns an Output matcher, which is the class that you see) which is the thing colliding with your method