Skip to content
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

Fix FixtureSupport#run_in_transaction? #2495

Merged
merged 1 commit into from Apr 28, 2021
Merged

Commits on Apr 28, 2021

  1. Fix FixtureSupport's run_in_transaction? method

    `ActiveRecord::TestFixture`'s `uses_transaction` is designed to be used
    like this:
    
    ```ruby
    uses_transaction :the_test_method_name
    ```
    
    And in RSpec, the method name would be the example's name.
    
    ```ruby
    uses_transaction "does someting"
    
    it "does someting" {}
    ```
    
    But in the current implementation, it's passing the example object
    instead of its name, which would always fail the name comparison in
    https://github.com/rails/rails/blob/adc0146a07ccc72405aec78ccb65aac3502a4300/activerecord/lib/active_record/test_fixtures.rb#L94-L97
    
    So this commit fixes the issue by passing the example's name instead of
    the example object.
    st0012 authored and pirj committed Apr 28, 2021
    Copy the full SHA
    9ce49af View commit details
    Browse the repository at this point in the history