case insensitivity in assert

I'm only a few days old in this whiz-bang rails world, so bear with me.

I'm in the middle of running functional tests, I've got some assert statements that check for the presence of a various tags on the page... One of the tags being checked is a form, and assert_tag checks that its :method => "POST". Unfortunately, the autogenerated form shows the value "post", and apparently that's just too much different (the assert fails).

Is there a way to call a case-insensitive assert? Here's the code in question:

assert_tag "form",            :attributes => { :action => "/user/register",              :method => "POST" }

I realize I can just change the assert to check for "post" and everything will be peachy, but this seems like something that could cause me problems again down the road if I don't figure it out now.

Thanks in advance.

You can give assert_tag a regular expression instead of just a string (and assert_select is often used instead of assert_tag these days)

Fred

Frederick Cheung wrote:

William Tell wrote:

You can give assert_tag a regular expression instead of just a string (and assert_select is often used instead of assert_tag these days)

Doh. Thanks, and for the assert tip.

Can you improve the code so its case is consistent? That would seem to fix the root problem here...

Phlip wrote:

William Tell wrote:

You can give assert_tag a regular expression instead of just a string (and assert_select is often used instead of assert_tag these days)

Doh. Thanks, and for the assert tip.

Can you improve the code so its case is consistent? That would seem to fix the root problem here...

--    Phlip

I'm not really sure -- the code is generated with form_for, and while I would imagine that function will consistently generate a lower-case "post", I'm not comfortable trusting the rest of the language (or myself) to stick with that convention.

The regular expression did it.