'I have delete method that doesn't have parameter, how do I test it using rspec 3.0+
I've been struggling to find how to do this. I have some tty-prompt gem to receive inputs from user and need to do rspec testing. But here I'm showing the simple logic that is similar to my code without using tty-prompt. I have this array of symbols
oceania = [:Australia, :'New Zealand', :Vanuatu]
and this is my delete method
def delete
puts "Enter a country: "
deleteanswer = gets.chomp.to_sym
oceania.delete(deleteanswer)
puts "Final result is:"
puts oceania
end
How do I rspec testing using rspec 3.0+ ??
Solution 1:[1]
After some research, the conclusion is there is no way to do rspec testing on a method that does not have a parameter where you suppose to pass argument with rspec testing. Hence I will close this post. Thank you all
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | skylinerr |
