That doesn't make sense as you cannot test insertion in database without inserting in the database. Why?
Rails comes with build-in validations that become the first step on saving an item. If the validations pass, the item is inserted through ActiveRecord in the database. The database validations starts on this step, and if any fails, they raise an exception.
So. If you want to test if the user might be created in the database, add the validations to the model that matches to the database. And then you will be able to use the method is_valid?
.
This will ensure that your user is valid to be stored in the database. And consequently, you will be able to use it anywhere knowing that: user_instance.is_valid?
defines an insertable item.
I hope this is what you where asking.