-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce duplication in & between Mock & ObjectMethods #431
base: main
Are you sure you want to change the base?
Commits on Nov 29, 2019
-
make arg iteration similar in expects & stubs
This will allow us to keep the code DRY by extracting a method with the identical bits
Configuration menu - View commit details
-
Copy full SHA for 22c594f - Browse repository at this point
Copy the full SHA 22c594fView commit details
Commits on Dec 4, 2019
-
Configuration menu - View commit details
-
Copy full SHA for ffac2ad - Browse repository at this point
Copy the full SHA ffac2adView commit details -
Configuration menu - View commit details
-
Copy full SHA for f700c36 - Browse repository at this point
Copy the full SHA f700c36View commit details -
Configuration menu - View commit details
-
Copy full SHA for da280b1 - Browse repository at this point
Copy the full SHA da280b1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7579416 - Browse repository at this point
Copy the full SHA 7579416View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7cff8fa - Browse repository at this point
Copy the full SHA 7cff8faView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7494b2d - Browse repository at this point
Copy the full SHA 7494b2dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5f83af5 - Browse repository at this point
Copy the full SHA 5f83af5View commit details -
Configuration menu - View commit details
-
Copy full SHA for b9422ba - Browse repository at this point
Copy the full SHA b9422baView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7a691d9 - Browse repository at this point
Copy the full SHA 7a691d9View commit details -
Configuration menu - View commit details
-
Copy full SHA for bf32420 - Browse repository at this point
Copy the full SHA bf32420View commit details -
Configuration menu - View commit details
-
Copy full SHA for 73cf959 - Browse repository at this point
Copy the full SHA 73cf959View commit details -
substitute algorithm for ArgumentIterator.each
Array will return a single-element array in case the arg is a single value, or a Hash converted to an array in case the arg is a Hash. We then yield the single element or the key value pair, and return the result of the last yield
Configuration menu - View commit details
-
Copy full SHA for b34726e - Browse repository at this point
Copy the full SHA b34726eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 547a4d5 - Browse repository at this point
Copy the full SHA 547a4d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for bf7ef4e - Browse repository at this point
Copy the full SHA bf7ef4eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 84e3ee7 - Browse repository at this point
Copy the full SHA 84e3ee7View commit details -
Configuration menu - View commit details
-
Copy full SHA for bfd20d8 - Browse repository at this point
Copy the full SHA bfd20d8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9761be3 - Browse repository at this point
Copy the full SHA 9761be3View commit details -
call Mock#{expects,stubs} with methods_vs_return_values
Mock#{expects,stubs} already handle methods_vs_return_values/method_name_or_hash Note that this change isn't 100% behavior preserving due to the separation of Mockery#stub_method call from the Mock#{expects,stubs} call. It's possible that midway through argument iteration, stub_method raises a StubbingError, which would leave some methods stubbed without having an expectation set for them. However, I think that's still OK, since you wouldn't expect anything useful to happen after a StubbingError anyway. We're changing undocumented/unpublished behavior in a way that shouldn't matter.
Configuration menu - View commit details
-
Copy full SHA for b2354df - Browse repository at this point
Copy the full SHA b2354dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7e7a61b - Browse repository at this point
Copy the full SHA 7e7a61bView commit details -
Configuration menu - View commit details
-
Copy full SHA for b87733f - Browse repository at this point
Copy the full SHA b87733fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2c4a5db - Browse repository at this point
Copy the full SHA 2c4a5dbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 262ea4c - Browse repository at this point
Copy the full SHA 262ea4cView commit details -
Refactor: rename stubbed_method->stubba_method_for
Keep the stubba_ prefix to avoid accidental name clash with other valid methods
Configuration menu - View commit details
-
Copy full SHA for 5a5ed50 - Browse repository at this point
Copy the full SHA 5a5ed50View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5f1c5f4 - Browse repository at this point
Copy the full SHA 5f1c5f4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 365884e - Browse repository at this point
Copy the full SHA 365884eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 19004e7 - Browse repository at this point
Copy the full SHA 19004e7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 201cfaa - Browse repository at this point
Copy the full SHA 201cfaaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2840411 - Browse repository at this point
Copy the full SHA 2840411View commit details
Commits on Feb 19, 2020
-
more consistent setting of multiple expectations
When calling expects/stubs with a hash (method_names_vs_return_values), only the last expectation would get returned. Any further 'expectation setting' methods chained to that call would, therefore, get called only on the last expectation. This seems arbitrary, and neither evident nor intuitive. We now 'extract' the expectation setting methods into a _virtual_ interface, 'implemented' by both Expectation and ExpectationSetting, and return ExpectationSetting instead of Expectation from the expects/stubs methods. This allows us to pass any further expectation setting method calls on to _each_ of the multiple expectations, rather than just the _last_ (or some other arbitrary) single expectation.
Configuration menu - View commit details
-
Copy full SHA for 583103b - Browse repository at this point
Copy the full SHA 583103bView commit details
Commits on Feb 21, 2020
-
move Mockery#stub_method call to ObjectMethods
Mock wasn't the right place for calling it. The new yield mechanism is more general and less ugly, and allocates responsibilities more appropriately.
Configuration menu - View commit details
-
Copy full SHA for b80cb98 - Browse repository at this point
Copy the full SHA b80cb98View commit details -
remove the Spanish Inquisition special case
Closes freerange#468 and sets us up to reduce the surface area of the internal API exposed to users, by inlining anticipates into expects and using that from stubs
Configuration menu - View commit details
-
Copy full SHA for 8a7af66 - Browse repository at this point
Copy the full SHA 8a7af66View commit details -
Refactor: inline anticipates into expects
This reduces the surface area of the internal API exposed to users as suggested in freerange#467
Configuration menu - View commit details
-
Copy full SHA for 9930e5a - Browse repository at this point
Copy the full SHA 9930e5aView commit details -
Refactor: ExpectationSetting->CompositeExpectation
Given that the public API of Expectation consists solely of expectation setting methods, and that the matching, verifying and other misc methods aren't part of the public API, it makes sense to equate the Expectation protocol implicitly to the ExpectationSetting protocol. If we were to segregate interfaces, we might wanna have other internal-facing interfaces like ExpectationMatching, etc. By naming this CompositeExpectation, we don't need (as much) to expose it or to include it in/update the documentation because as far as clients are concerned, they still get back an Expectation (technically, something that quacks like an Expectation).
Configuration menu - View commit details
-
Copy full SHA for 1906a10 - Browse repository at this point
Copy the full SHA 1906a10View commit details