Novo neste fórum. Tentando executar um teste para encontrar â
ou €
Usando asserção
text.include? "â" , "€"
Mas recebendo erros.
Respostas:
3 para resposta № 1Experimentar:
text.include?("â") || text.include?("€")
OU:
/â|€/.match(text)
0 para resposta № 2
Eu faria assim, desde que o include?
método não leva uma matriz:
["â", "€"].any? { |char| text.include?(char) }
0 para resposta № 3
Eu presumo que você está usando minitest? Você pode usar assert_match
:
assert_match(/[â€]/, "text with â")
#=> true
assert_match(/[â€]/, "text with €")
#=> true
assert_match(/[â€]/, "text without")
#=> MiniTest::Assertion: Expected /[â€]/ to match "text without".