Sha256: 60d9c625c503902fdae6e7aa89f574a21471bf27550325823421980e20489b5d

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

# frozen_string_literal: true

module NPlusOneControl
  module RSpec
    # Includes scale method into RSpec Example
    module DSL
      # Extends RSpec ExampleGroup with populate & warmup methods
      module ClassMethods
        # Setup warmup block, wich will run before matching
        # for example, if using cache, then later queries
        # will perform less DB queries than first
        def warmup(&block)
          return @warmup unless block

          @warmup = block
        end

        # Setup populate callback, which is used
        # to prepare data for each run.
        def populate(&block)
          return @populate unless block

          @populate = block
        end
      end

      attr_accessor :executor

      def current_scale
        executor&.current_scale
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
n_plus_one_control-0.6.2 lib/n_plus_one_control/rspec/dsl.rb
n_plus_one_control-0.6.1 lib/n_plus_one_control/rspec/dsl.rb