partnerpedia/mobile_defense — comment on commit 554cb3a7af7a11048da499da4f269e948eba8c2d
File: spec/lib/scannable_model_spec.rb line 69
By cpb:

The return value of ```.and_return(@resp)``` is a ```Proc```. It is the ```Proc``` which will be called as the ```initiate_scan!``` stub. In this case it is stubeed to return ```@resp```.

The ```[]``` method of ```Proc``` is basically the same as ```call``` -- consequently the return value of ```subject.stub(:initiate_scan!).with(@path_to_file).and_return(@resp)[]``` is ```@resp```.

What does this mean?

It means that all of these expectations are checking these values: https://github.com/partnerpedia/mobile_defense/blob/master/spec/lib/scannable_model_spec.rb#L28-37

In no way does this code test anything else.