Print Function Tests
This is an example of how you can test the output stream of a student defined function.
Ruby makes this super easy with the output
matcher.
expect { print 'foo' }.to output('foo').to_stdout
This test makes sure the student's function named prints_name()
that takes a name as a parameter and prints "Hello, {name provided}!"
to standard output. It assumes the student's file name is example.rb
. Replace the require
with whatever your student's file name is.
Grading Tests:
Sample Solution:
example.rb
Last updated