# :loaded not called in test environment

**URL:** <https://www.ruby-forum.com/t/loaded-not-called-in-test-environment/170480>\
**Category:** Rails\
**Created:** [June 18, 2009, 1:35am UTC](https://www.ruby-forum.com/t/loaded-not-called-in-test-environment/170480 "2009-06-18T01:35:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 18, 2009, 1:35am UTC](https://www.ruby-forum.com/t/loaded-not-called-in-test-environment/170480/1 "2009-06-18T01:35:37Z")

</div>

I have a remote\_form\_for with :loading and :loaded specified like so:

\<% remote\_form\_for @some\_object,  
:loading =\> “document.body.style.cursor = ‘wait’”,  
:loaded =\> “document.body.style.cursor = ‘default’” do |f| %\>  
…  
\<% end %\>

So I want to display the “wait” icon until the form returns a result and  
then change it back to normal.

My problem is that this works great in development environment, but not  
in testing. Pretend that Ajax request returned some error messages, so  
the form does not get redrawn. So if the user submits the form a few  
more times eventually :loaded will not be called and the user is stuck  
with the hourglass “wait” icon. Sometimes :loaded doesn’t get called the  
first time the form is submitted.

This only happens in test environment and thus my selenium tests fail.

Any clues?

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [June 18, 2009, 7:07pm UTC](https://www.ruby-forum.com/t/loaded-not-called-in-test-environment/170480/2 "2009-06-18T19:07:36Z")

</div>

Seems a good old reboot fixed this problem…
