Sha256: b9ad65e42b7d302a05f7bf4caf295096728c41a4489799ac267743db660e55fb

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require "bullet"

RSpec.configure do |config|
  Decidim::ApplicationJob.include(Bullet::ActiveJob) if defined?(Bullet::ActiveJob)

  Rails.application.config.after_initialize do
    Bullet.enable = Decidim::Env.new("DECIDIM_BULLET_ENABLED", "true").present?
    Bullet.rails_logger = true
    Bullet.raise = true
    Bullet.stacktrace_includes = %w(decidim-)

    # Detect N+1 queries
    Bullet.n_plus_one_query_enable = Decidim::Env.new("DECIDIM_BULLET_N_PLUS_ONE", "false").present?
    # Detect eager-loaded associations which are not used
    Bullet.unused_eager_loading_enable = Decidim::Env.new("DECIDIM_BULLET_UNUSED_EAGER", "false").present?
    # Detect unnecessary COUNT queries which could be avoided with a counter_cache
    Bullet.counter_cache_enable = Decidim::Env.new("DECIDIM_BULLET_COUNTER_CACHE", "true").present?
  end

  if Bullet.enable?
    config.before(:each) do
      Bullet.start_request
    end

    config.after(:each) do
      Bullet.perform_out_of_channel_notifications if Bullet.notification?
      Bullet.end_request
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-dev-0.28.4 lib/decidim/dev/test/rspec_support/bullet.rb
decidim-dev-0.28.3 lib/decidim/dev/test/rspec_support/bullet.rb
decidim-dev-0.28.2 lib/decidim/dev/test/rspec_support/bullet.rb
decidim-dev-0.28.1 lib/decidim/dev/test/rspec_support/bullet.rb
decidim-dev-0.28.0 lib/decidim/dev/test/rspec_support/bullet.rb
decidim-dev-0.28.0.rc5 lib/decidim/dev/test/rspec_support/bullet.rb
decidim-dev-0.28.0.rc4 lib/decidim/dev/test/rspec_support/bullet.rb