page 227, paragraph 11, i.e. after
obj = double(cost: “cheap”, name: “banana”)
obj.cost
obj.banana
Twice the in the next line :
In minitest, we talked about validating mock objects by having the test fail if the the method
-----> ^^^^^^^
+++++ third paragraph from bottom, two typos : and instead of as, superfluous it
The expect behaves the same and allow except that it at the end of the spec RSpec automatically
-----> ^^^ as -----> ^^
I had to do some research to refresh my Rspec knowledge in order to understand this sentence.
RSpec.describe 'check if received' do
before(:each) do
@movie = double('Jaws')
allow(@movie).to receive(:record_review).with('Great movie!')
end
it 'allowed' do
end
it 'received' do
expect(@movie).to receive(:record_review).with('Great movie!')
@movie.record_review('Great movie!')
end
it 'not received' do
expect(@movie).to receive(:record_review).with('Great movie!')
end
end
% rspec -fd check_received.rb
check if received
allowed
received
not received (FAILED - 1)
Failures:
1) check if received not received
Failure/Error: expect(@movie).to receive(:record_review).with('Great movie!')
(Double "Jaws").record_review("Great movie!")
expected: 1 time with arguments: ("Great movie!")
received: 0 times
...