[go: up one dir, main page]

Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: freerange/mocha
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.5.0
Choose a base ref
...
head repository: freerange/mocha
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.6.0
Choose a head ref
  • 13 commits
  • 64 files changed
  • 1 contributor

Commits on Nov 9, 2024

  1. 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.
    floehopper committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    174e86a View commit details
    Browse the repository at this point in the history
  2. 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.
    floehopper committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    468a313 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #680 from freerange/simplify-backtrace-related-ass…

    …ertions
    
    Simplify backtrace-related assertions
    floehopper authored Nov 9, 2024
    Configuration menu
    Copy the full SHA
    f899c03 View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2024

  1. Remove unused ExpectationList#match_but_out_of_order

    This was added in this commit [1] as part of #633, but was never used. I
    suspect it was accidentally left over after I changed my mind and added
    the optional `ignoring_order` keyword argument to
    `ExpectationList#match`.
    
    [1]: 0800c6f
    floehopper committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    f2fa991 View commit details
    Browse the repository at this point in the history
  2. 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.
    floehopper committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    19b27d1 View commit details
    Browse the repository at this point in the history
  3. Add Cardinality#invocations_never_allowed?

    I'm planning to use this in a subsequent commit.
    floehopper committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    b24bd4e View commit details
    Browse the repository at this point in the history
  4. Add Expectation#invocations_never_allowed?

    I'm planning to use this in a subsequent commit.
    floehopper committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    471b996 View commit details
    Browse the repository at this point in the history
  5. Add ExpectationList#match_never_allowing_invocation

    I'm planning to use this in a subsequent commit.
    floehopper committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    212ba0b View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2024

  1. 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
    floehopper committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    49b99ff View commit details
    Browse the repository at this point in the history
  2. 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)
    floehopper committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    e0b6dae View commit details
    Browse the repository at this point in the history
  3. Merge pull request #681 from freerange/expectation-with-never-cardina…

    …lity-should-display-deprecation-warning
    
    Expectation with never cardinality should display deprecation warning
    floehopper authored Nov 24, 2024
    Configuration menu
    Copy the full SHA
    59e0ab1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5448b23 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    862237d View commit details
    Browse the repository at this point in the history
Loading