Skip to content

Can't disable unused_eager_loading_enable in test #481

@sfcgeorge

Description

@sfcgeorge

As other issues note Bullet seems to have eager load false positives in test mode.

So the obvious workaround is to disable the unused eager loading check in test mode like so:

# config/environments/test.rb
  # ...
  config.after_initialize do
    Bullet.enable = true
    Bullet.bullet_logger = true
    Bullet.raise = true
    Bullet.n_plus_one_query_enable = true
    Bullet.unused_eager_loading_enable = false
    Bullet.counter_cache_enable = false
  end
end

This doesn't work! I still get errors. I have cleared tmp/cache and restarted Spring. The only thing that does work is completely disabling bullet in tests:

# config/environments/test.rb
  # ...
  config.after_initialize do
    Bullet.enable = false
    # ...
  end
end

All I can think is that Bullet.n_plus_one_query_enable must be a singleton method and as feature specs run in a separate thread maybe the bullet config is different in the feature server thread?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions