Issues with Functional Tests

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

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

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

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

I can workaround by using

assert_select “div#notice”, /whatever/

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

(2) One of the things I’d most like to test is simply whether the
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
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?



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs