I'm having trouble testing helpers. I've found the topfunky helper
testing plugin (http://nubyonrails.com/articles/2006/04/07/test-your-
helpers), and I've seen the helper testing discussion in the rails
recipe book, but both are falling short. Please let me know if I'm
My helpers often need access to current url details, such as the
action and params, and session values. These solutions don't seem to
What would be really nice is to have a functional test that would
establish the state for the url and session, and then have it yield or
call back so that the helper functions could be tested.
I might be able to do helper tests *after* the processing of the
request (in a functional test), if I could figure out how to invoke
My best idea so far is to refactor my helper methods so that I have a
version of the function that doesn't rely on the session or controller
state, and instead has the appropriate values provided as parameters.
Any other ideas or suggestions?
I'm ripping my hair out this one.
I have two select boxes. Both have an 'observe_field' on it. The first
select box, when changed, will clear the second select box and, if it needs
to, adds new options to the second select box. The second select box, when
changed, will grab a number from the database and put it in a text box.
This all works great, except for the following circumstance.
1. The second select box is changed to the second option in the list, The
text box is updated.
2. The first select box is changed to another option, clearing the second
3. The first select box is changed to the first option it was on, filling
the second select box with options, with the first option in the list
4. The second select box is changed to the second option in the list.
The 'observe_field' never fires.
After that, if I pick different selections in the list, it works fine. So
if I pick the first option and then the second option again, it works.
Has anyone else run into this problem. It seems to happen on both Firefox 2
and IE 7.
I've tried clearing the list in many different ways: Setting the length to
0, looping backwards through the list and setting each option to null.
I've also tried many different ways to set the selection: setting
selectedIndex to 0, adding true to the Option when it's created when it's
the first, setting options.selected = true.
Nothing seems to work.