tenacity
tenacity copied to clipboard
Tenacity::ObjectDoesNotExistError thrown for mocks/stubs
In my rspec tests I use stubbed foreign id's which causes Tenacity::ObjectDoesNotExistError errors to be thrown from t_belongs_to associations. Is there a way to make existence validation optional?
There is currently no way to disable this check. The code that raises this exception is here:
https://github.com/jwood/tenacity/blob/master/lib/tenacity/instance_methods.rb#L24
The _t_verify_associates_exist
method is invoked as a before_save
callback on the model.
I'm not actively working on Tenacity at the moment, but I will accept pull requests if you feel like taking a crack at this.