tenacity icon indicating copy to clipboard operation
tenacity copied to clipboard

Tenacity::ObjectDoesNotExistError thrown for mocks/stubs

Open w1150n opened this issue 11 years ago • 1 comments

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?

w1150n avatar Apr 11 '13 15:04 w1150n

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.

jwood avatar Apr 11 '13 16:04 jwood