# Issues with Functional Tests

**URL:** <https://www.ruby-forum.com/t/issues-with-functional-tests/92633>\
**Category:** Rails\
**Created:** [April 21, 2007, 11:08pm UTC](https://www.ruby-forum.com/t/issues-with-functional-tests/92633 "2007-04-21T23:08:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stickstone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Post date:** [April 21, 2007, 11:08pm UTC](https://www.ruby-forum.com/t/issues-with-functional-tests/92633/1 "2007-04-21T23:08:57Z")

</div>

I’m running rails-1.2.3 under Ubuntu 6.06, and I’ve come across a few  
issues  
I’d like to raise.

(1) If a controller sets flash.now[:notice] = “message”, then in a  
functional test I don’t seem to be able to match it.

flash.inspect shows “{}” and flash.now.inspect shows  
“#\<ActionController::Flash::FlashNow:0xb63c4ecc @flash={}\>”

However it’s fine for a normal flash message with a redirect. Is there a  
way  
to test directly that a controller has put something into flash.now ?

I can workaround by using

assert\_select “div#notice”, /whatever/

although that hard-codes knowledge of what the layout is using to  
display  
the flash.

(2) One of the things I’d most like to test is simply whether the  
resulting  
page is well-formed XHTML, to check if I’ve missed out any balancing  
tags in  
my RHTML templates. Ideally I’d like “assert\_result :success” to check  
for  
well-formedness, or to have a separate assert\_well\_formed.

What would be the best way to achieve this? Does  
assert\_select “html”  
by itself enforce that the entire document is well-formed?

(3) When using submit\_tag, there doesn’t seem to be a simple way to do  
:confirm =\> “Are you sure?” like you can with link\_to and button\_to.

I can workaround by writing something like this:

\<%= submit\_tag “Copy”, :onclick =\> “return  
#{confirm\_javascript\_function(“Are you sure?”)};” %\>

Is there an easier way to achieve this?

Regards,

Brian.
