I am trying to check if the value in a data table is correct so what I do is select all the rows and check if that certain tr has_content of the object name and value i am checking for. Problem is, I can’t seem to do a return in cucumber:
Then /^I should see "([^"]*)" beside "([^"]*)"$/ do |value, name|
all("tr").each do |tr|
if tr.has_content?(value) && tr.has_content?(name)
assert true and return
end
end
assert false
end
I want something like that. When I find a row that has both the values, then that means it is correct and I should stop the loop and just return true(otherwise it will continue on to the assert false in the end)
How do I go about this?
well it seems like a dirty hack but I just used a variable to check:
I’m not sure if it will work in all cases…but if you have better solutions please post it too. thanks!