I'm preparing tests in Ruby/Cucumber/Calabash. I have a text file full of logs. I need to check if specific line/sentence is present in the logs e.g "Please answer my question". I assume that every word independently is present few times, but in this line only once. I need to return TRUE. So far when I tried with:
def check_file( file, string )
File.open( file ) do |io|
io.each {|line| line.chomp! ; return line if line.include? string}
end
nil
end
and it's always working even string doesn't exist (I'm not sure why?)
Should I try arrays?