[rspec-users] regular expression hang ruby.exe

3 views
Skip to first unread message

Mattias A.

unread,
May 8, 2013, 3:22:53 AM5/8/13
to rspec...@rubyforge.org
Hi,

I use an regular expression to verify that my string in time_on_site is
correct. This works when the string match, but if it doesn't the test
get hanged. So I need to quit(ctrl+c) the script and also close ruby.exe
*32 in Task manager. Any ides how I can handle this?

time_on_site.should match(/^00:[0-5][0-9]$/)


Best regards
Mattias

--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Ben Lovell

unread,
May 8, 2013, 3:48:43 AM5/8/13
to rspec-users
On 8 May 2013 08:22, Mattias A. <li...@ruby-forum.com> wrote:
Hi,

I use an regular expression to verify that my string in time_on_site is
correct. This works when the string match, but if it doesn't the test
get hanged. So I need to quit(ctrl+c) the script and also close ruby.exe
*32 in Task manager. Any ides how I can handle this?

time_on_site.should match(/^00:[0-5][0-9]$/)


Best regards
Mattias


Hey Mattias,

Very peculiar. Could you produce the smallest possible script to reproduce this?

Thanks,
Ben 

Mattias A.

unread,
May 8, 2013, 3:42:42 AM5/8/13
to rspec...@rubyforge.org
If I use below it returns correct output. Can I use something similar
with Rspec so the test fails if its not true?

if time_on_site =~ /^00:[0-5][0-9]$/
puts "# Successful match"
else
puts "# Match attempt failed"
end
Reply all
Reply to author
Forward
0 new messages