Functional tests and active scaffold: unexpected assertion failure.

Hello,

I'm writing a functional test for a controller that uses active scaffold.

def test_presence_of_field   login_as(:peter)   profile = Profile.find :first   get :edit, {:id => profile.id}   assert_response 200   assert_select "textarea#record_free_text_ec" end

I was expecting the first 'assert 200' to give me a green bar, but added it for confirmation, and indeed it gives me te following failure: Expected response to be a <200>, but was <0>

The same assertion works fine when I don't use active scaffold.

Does anyone know how to solve this problem?

Cheers,

Gian

Just for the records, for whoever might end up on this thread.

I found out what the problem was, it has nothing to do with active scaffold.

The cause of this problem was a missing fixture in my tests.

More specifically. I use the plug in act_as_authenticated, and the first line in my tests is usually login_as(:peter), that sets the user as logged in.

The method login_as worked fine, and the @current_user instance variable was set in my controllers, but the instances of an association (i.e. has_and_belongs_to_many :roles) where not made and not set in the specific user instance, this caused some conditions to fail and resulted in a redirect.

Moral of the story: I needed to add an extra fixture to my functional test.