[wtr-general] Watir, Rspec, and radio buttons.

2010-02-09 Thread James
I'm trying to check if a radio button is checked or not, using the
Rspec should command, but it's not acting as I would expect.

My code:

puts questionframe.radio(:id, rlbYesNo_0).checked?
questionframe.radio(:id, rlbYesNo_0).checked? should equal true

It outputs true for the first line, but for the second line, it
gives this error:

expected #TrueClass:2 = true
 got #String:103356170 = Yesno

It does return true when I print it to the screen, but when using
should to check it, it somehow thinks it returns the text Yesno.

Can anyone explain what's going on and what I can do to fix this?

Thanks,
James

-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general


Re: [wtr-general] Watir, Rspec, and radio buttons.

2010-02-09 Thread Charley Baker
Wrong matcher, use be_true instead:

questionframe.radio(:id, rlbYesNo_0).checked? should be_true



-Charley
Lead Developer, Watir, http://watir.com


On Tue, Feb 9, 2010 at 8:58 AM, James jgcpal...@gmail.com wrote:

 I'm trying to check if a radio button is checked or not, using the
 Rspec should command, but it's not acting as I would expect.

 My code:

puts questionframe.radio(:id, rlbYesNo_0).checked?
questionframe.radio(:id, rlbYesNo_0).checked? should equal true

 It outputs true for the first line, but for the second line, it
 gives this error:

 expected #TrueClass:2 = true
 got #String:103356170 = Yesno

 It does return true when I print it to the screen, but when using
 should to check it, it somehow thinks it returns the text Yesno.

 Can anyone explain what's going on and what I can do to fix this?

 Thanks,
 James

 --
 You received this message because you are subscribed to the Google Groups
 Watir General group.
 To post to this group, send email to watir-general@googlegroups.com
 Before posting, please read the following guidelines:
 http://wiki.openqa.org/display/WTR/Support
 To unsubscribe from this group, send email to
 watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/watir-general


-- 
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general