Unit Test and RecordNotSaved

I have a Company model that has an after_create callback that creates
default roles, users, etc for the new company. In the development
environment, this all works great. In my company unit test however, an
ActiveRecord::RecordNotSaved is thrown on the first attempt to create a
role for the new company (and this is also the first attempt to create
anything in the after_create callback). I have added logger statements
in the code to verify that both the company and new role are valid, and
they are. Is there something I am missing? If not, is there a better way
to track down why I am getting a RecordNotSaved?

TIA,
-Bill


Sincerely,

William P.

On Jan 19, 2008 9:41 AM, William P. [email protected] wrote:


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.

What I meant to say was:

Do @company.save and then puts @company.errors to see what errors there
are.

There are no errors. Both the company and the role are valid and the
company is already saved at this point. I logged a company.inspect and
it shows new_record to be false. Both the company and the role return
true from a call to valid?.

-Bill

Ryan B. wrote:

What I meant to say was:

Do @company.save and then puts @company.errors to see what errors
there are.


Sincerely,

William P.

Nm, I found it. I have an abstract base class that was catching a
condition and not injecting the error before returning false. Thanks
anyway Ryan.

-Bill

William P. wrote:

TIA,
-Bill


Sincerely,

William P.