Specs for where $_ is defined and when it is defined?

You need an expectation because while you invoke a side effect, you don't assert that the expected state change occurred. When you read from a file, $_ is set.