On Tue, Nov 25, 2008 at 11:16 PM, Pau Cor <[EMAIL PROTECTED]> wrote:
> Hi. I'm trying to write a matcher to make sure a radio button is
> selected when the page loads.
>
> I got this at the moment:
>
> When /^I leave "(.*)" selected$/ do |label|
>  field = field_labeled label
>  unless field.instance_variable_get("@element")['checked'] &&
> field.instance_variable_get("@element")['checked'] == "checked"
>    raise "Expected radio button with label #{label} to be checked, but
> it wasn't"
>  end
> end
>
> But I'm kind of assuming that there is a reason that @element isn't
> accessible. Is there a better way to do this?

Have you tried using a CSS3 selector with something like have_tag ?

response.should
have_tag("input[type=radio][checked=checked][name=?][valued=?]",
"your[button]", "foo")



-- 
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to