Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
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: rspec/rspec-expectations
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.8.2
Choose a base ref
...
head repository: rspec/rspec-expectations
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.8.3
Choose a head ref
  • 14 commits
  • 21 files changed
  • 6 contributors

Commits on Oct 20, 2018

  1. Merge pull request #1081 from orien/project-metadata

    Add project metadata to the gemspec
    JonRowe committed Oct 20, 2018
    Configuration menu
    Copy the full SHA
    3eccdd0 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2018

  1. Fix nested all repeated failure message (#1086)

    `RSpec::Matchers::BuiltIn::All` keeps track of which objects failed at
    which index of the actual value in a `@failed_objects` hash. The matcher
    considers a match successful if `@failed_objects` is empty. When the
    matcher is composed inside another matcher, the matcher gets cloned
    before matching against each item in the actual collection.  The
    `@failed_objects` hash doesn't itself get cloned, resulting in each
    cloned matcher having a reference to the same hash. This means that once
    a matcher (or one of its clones) fails – populating `@failed_objects` –,
    each of its clones will fail matching regardless of whether it matched
    or not, as each clone's `@failed_objects` reference is not empty. This
    leads to behavior like the following, where we see the first failure
    (expecting `false` to be `true`) repeated twice.
    
    ```
    expect([[true], [false]]).to all(all(be(false)))
    
    RSpec::Expectations::ExpectationNotMetError: expected [[true], [false]] to all all equal false
    
       object at index 0 failed to match:
          expected [true] to all equal false
    
             object at index 0 failed to match:
                expected false
                     got true
    
       object at index 1 failed to match:
          expected [false] to all equal false
    
             object at index 0 failed to match:
                expected false
                     got true
    ```
    
    The solution here is to clone the `@failed_objects` hash when the
    matcher itself is cloned. So long as the matcher itself is cloned
    immediately after construction (while `@failed_objects` is empty)
    – which is what actually happens – we avoid this bug.
    
    Alternative solutions include:
    
    * calling `@failed_objects.clear` at the start of each `matches?` call
    * lazily defining `@failed_objects` (i.e. outside of the constructor) so
      that when the matcher is cloned, `@failed_objects` isn't defined yet
      and so cannot have shared references to it
    
    However, the pattern already exists where, when the matcher is cloned,
    its 'submatcher' (composed matcher) is cloned. Cloning `@failed_objects`
    at this time follows the same pattern.
    english authored and JonRowe committed Nov 23, 2018
    Configuration menu
    Copy the full SHA
    9ac91f7 View commit details
    Browse the repository at this point in the history
  2. Changelog for #1086

    JonRowe committed Nov 23, 2018
    Configuration menu
    Copy the full SHA
    c163b99 View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2019

  1. Handle subject hash change after change matcher has run (#1100)

    #1034 introduced a hash comparison in addition to an equality check. The change compared not only the objects themselves, but also their hashes which broke for poorly behaving Ruby objects.
    
    E.g. (using `rspec-rails`):
    
        it { expect { 'noop' }.not_to change { country.reload.cities } }
    
    By caching the hash immediately after the block has run we should be able to work around such examples.
    pirj authored and JonRowe committed Apr 19, 2019
    Configuration menu
    Copy the full SHA
    f9f560d View commit details
    Browse the repository at this point in the history
  2. Changelog for #1100

    JonRowe committed Apr 19, 2019
    Configuration menu
    Copy the full SHA
    c090125 View commit details
    Browse the repository at this point in the history
  3. Added warning message for BasicObject with unsupported matchers (#1107)

    BasicObject doesn't define certain Ruby methods matchers rely on, in this case issue an ArgumentError to better explain the error.
    
    * Added kindly failure message for #1105
    * raise ArgumentError instead of printing special failure message
    * added examples for following cases
    - actual object does not respond to #kind_of? method
    - actual object does not respond to #is_a? method
    * removed #error_message method and give the error message inline
    taichi-ishitani authored and JonRowe committed Apr 19, 2019
    Configuration menu
    Copy the full SHA
    6679fd4 View commit details
    Browse the repository at this point in the history
  4. Changelog for #1107

    JonRowe committed Apr 19, 2019
    Configuration menu
    Copy the full SHA
    5946b8b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0d3c62e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c6f24fb View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1df0713 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    cf11295 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    3a71eba View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    1cc4fb9 View commit details
    Browse the repository at this point in the history

Commits on Apr 20, 2019

  1. Bump to 3.8.3

    JonRowe committed Apr 20, 2019
    Configuration menu
    Copy the full SHA
    14fe2e9 View commit details
    Browse the repository at this point in the history
Loading