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 flaky spec #712

Merged
merged 2 commits into from
Aug 11, 2024
Merged

Fix flaky spec #712

merged 2 commits into from
Aug 11, 2024

Conversation

ildarkayumov
Copy link
Contributor

Context

There were some tests with data leaked out to other tests

BUNDLE_GEMFILE=Gemfile.rails-7.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-7.2 bundle exec rspec './spec/integration/active_record/association_spec.rb[1:5:1,2:1:6]' --seed 18477

Bundle complete! 7 Gemfile dependencies, 73 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Run options: include {:focus=>true, :ids=>{"./spec/integration/active_record/association_spec.rb"=>["1:5:1", "2:1:6"]}}

Randomized with seed 18477
.F

Failures:

  1) Bullet::Detector::Association has_many category => posts => writer should not detect unused preload associations
     Failure/Error: post.writer.name

     NoMethodError:
       undefined method `name' for nil
     # ./spec/integration/active_record/association_spec.rb:264:in `block (4 levels) in <top (required)>'
     # ./spec/integration/active_record/association_spec.rb:262:in `map'
     # ./spec/integration/active_record/association_spec.rb:262:in `block (3 levels) in <top (required)>'

Finished in 0.15346 seconds (files took 0.48094 seconds to load)
2 examples, 1 failure

Failed examples:

rspec ./spec/integration/active_record/association_spec.rb:260 # Bullet::Detector::Association has_many category => posts => writer should not detect unused preload associations

Changes

  1. Bullet::Detector::Association: destroy Post created during in an after_save
  2. Bullet::Detector::Association: destroy Documents created during document => children

@flyerhzm flyerhzm merged commit 367b62d into flyerhzm:main Aug 11, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants