-
-
Notifications
You must be signed in to change notification settings - Fork 158
Comparing changes
Open a pull request
base repository: freerange/mocha
base: v2.5.0
head repository: freerange/mocha
compare: v2.6.0
- 13 commits
- 64 files changed
- 1 contributor
Commits on Nov 9, 2024
-
Use ExecutionPoint#location to simplify assertions
Since the `ExecutionPoint` already stores the full backtrace, we should already have it in the format for the relevant Ruby version. Using this is a lot simpler than having to generate the line from scratch.
Configuration menu - View commit details
-
Copy full SHA for 174e86a - Browse repository at this point
Copy the full SHA 174e86aView commit details -
Use Expectation#definition_location to simplify assertions
Since the `Expectation` instance already "knows" where it was defined, it's simpler to use `Expectation#definition_location` to make these assertions. And again, since this is obtained directly from the backtrace, it should be in the format for the relevant Ruby version.
Configuration menu - View commit details
-
Copy full SHA for 468a313 - Browse repository at this point
Copy the full SHA 468a313View commit details -
Merge pull request #680 from freerange/simplify-backtrace-related-ass…
…ertions Simplify backtrace-related assertions
Configuration menu - View commit details
-
Copy full SHA for f899c03 - Browse repository at this point
Copy the full SHA f899c03View commit details
Commits on Nov 13, 2024
-
Configuration menu - View commit details
-
Copy full SHA for f2fa991 - Browse repository at this point
Copy the full SHA f2fa991View commit details -
Extract local vars outside if/else in Mock#handle_method_call
I'm about to make some changes in this area and this will make it easier to see what's going on.
Configuration menu - View commit details
-
Copy full SHA for 19b27d1 - Browse repository at this point
Copy the full SHA 19b27d1View commit details -
Add Cardinality#invocations_never_allowed?
I'm planning to use this in a subsequent commit.
Configuration menu - View commit details
-
Copy full SHA for b24bd4e - Browse repository at this point
Copy the full SHA b24bd4eView commit details -
Add Expectation#invocations_never_allowed?
I'm planning to use this in a subsequent commit.
Configuration menu - View commit details
-
Copy full SHA for 471b996 - Browse repository at this point
Copy the full SHA 471b996View commit details -
Add ExpectationList#match_never_allowing_invocation
I'm planning to use this in a subsequent commit.
Configuration menu - View commit details
-
Copy full SHA for 212ba0b - Browse repository at this point
Copy the full SHA 212ba0bView commit details
Commits on Nov 24, 2024
-
Warning if invocation matches never expectation
Currently when an invocation matches an expectation which does not allow invocations (i.e. `Expectation#never` has been called on it), but the invocation also matches another expectation which does allow invocations, then the test does not fail with an unexpected invocation error. In #679 I'm planning to change this behaviour so the test fails fast with an unexpected invocation error. This commit displays a deprecation warning instead to give users a chance to update their code before the actual change is made. The new behaviour will bring the behaviour into line with what is already the case for mocks where `Mock#stub_everything` has been called as per this acceptance test [1] that was introduced in this commit [2]. [1]: https://github.com/freerange/mocha/blob/f2fa99197f35e2d2ce9554db63f6964057e29ce0/test/acceptance/expected_invocation_count_test.rb#L202-L214 [2]: d358377
Configuration menu - View commit details
-
Copy full SHA for 49b99ff - Browse repository at this point
Copy the full SHA 49b99ffView commit details -
Avoid invoking matcher block multiple times
In the previous commit, the changes meant that a block provided to `Expectation#with` was being invoked three times instead of once. The original behaviour was not explicitly documented and there is code in the wild [1] that relies on `Expectation#with` only being called once per invocation. I'm not convinced that test code should be relying on this behaviour, but from a performance point-of-view, it probably makes sense to avoid calling the matching methods on `ExpectationList` multiple times unnecessarily. This commit changes the code in `Mock#handle_method_call` to avoid unnecessary calls to these methods. I've created #682 to suggest improving the docs for `Expectation#with` when it takes a block argument to address the ambiguity that has become apparent. [1]: #681 (comment)
Configuration menu - View commit details
-
Copy full SHA for e0b6dae - Browse repository at this point
Copy the full SHA e0b6daeView commit details -
Merge pull request #681 from freerange/expectation-with-never-cardina…
…lity-should-display-deprecation-warning Expectation with never cardinality should display deprecation warning
Configuration menu - View commit details
-
Copy full SHA for 59e0ab1 - Browse repository at this point
Copy the full SHA 59e0ab1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5448b23 - Browse repository at this point
Copy the full SHA 5448b23View commit details -
Configuration menu - View commit details
-
Copy full SHA for 862237d - Browse repository at this point
Copy the full SHA 862237dView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v2.5.0...v2.6.0