Created
July 1, 2015 18:54
-
-
Save SophieDeBenedetto/eef14ecf6d5b595d7513 to your computer and use it in GitHub Desktop.
looping repl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Using the `loop` method | |
It's your first year at Hogwarts and you're having a tough time getting the hang of that levitation spell. Fill out the content of the method `looping` puts the | |
levitation charm "Wingardium Leviosa" 10 times using the `loop` keyword. | |
```ruby | |
def looping | |
#your code here | |
end | |
~~~solution | |
def looping | |
loop do | |
puts "Wingardium Leviosa" | |
puts "Wingardium Leviosa" | |
puts "Wingardium Leviosa" | |
puts "Wingardium Leviosa" | |
puts "Wingardium Leviosa" | |
puts "Wingardium Leviosa" | |
puts "Wingardium Leviosa" | |
end | |
end | |
looping | |
~~~validation | |
looping_string = "Wingardium Leviosa\nWingardium Leviosa\nWingardium Leviosa\nWingardium Leviosa\nWingardium Leviosa\nWingardium Leviosa\nWingardium Leviosa\n" | |
expect{ looping }.to output(looping_string).to_stdout | |
``` | |
%%% | |
my question: I realize that I can’t use expectation like that but I’m wondering if there is anyway to test “puts”-ing in the repl? what is the `response` that the assertions/expectations are testing? is it the return value of what is executed in the repl that the student’s code? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment