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.

On Apr 8, 4:01 am, William T. [email protected]
wrote:

cause me problems again down the road if I don’t figure it out now.

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 C. wrote:

On Apr 8, 4:01�am, William T. [email protected]
wrote:

cause me problems again down the road if I don’t figure it out now.

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

Doh. Thanks, and for the assert tip.

Cheers
cb

Phlip wrote:

William T. 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.

William T. 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