Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions spec/13_input_output_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@
end

context 'when user inputs an incorrect value once, then a valid input' do
# A method stub can be called multiple times and return different values.
# https://relishapp.com/rspec/rspec-mocks/docs/configuring-responses/returning-a-value
# Create a stub method to receive :player_input and return the invalid
# 'letter' input, then the 'valid_input'

# As the 'Arrange' step for tests grows, you can use a before hook to
# separate the test from the set-up.
# https://relishapp.com/rspec/rspec-core/v/2-0/docs/hooks/before-and-after-hooks\
# https://www.tutorialspoint.com/rspec/rspec_hooks.htm

before do
# A method stub can be called multiple times and return different values.
# https://relishapp.com/rspec/rspec-mocks/docs/configuring-responses/returning-a-value
# This method stub for :player_input will return the invalid 'letter' input,
# then it will return the 'valid_input'
letter = 'd'
valid_input = '8'
allow(game_loop).to receive(:player_input).and_return(letter, valid_input)
Expand Down