Sha256: e596ce701e7098f7d894e9bac071b6dbb461c6ad040b1e79e9fb3411f56fc0e2

Contents?: true

Size: 825 Bytes

Versions: 4

Compression:

Stored size: 825 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
          return @warmup unless block_given?

          @warmup = Proc.new
        end

        # Setup populate callback, which is used
        # to prepare data for each run.
        def populate
          return @populate unless block_given?

          @populate = Proc.new
        end
      end

      attr_accessor :executor

      def current_scale
        executor&.current_scale
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
n_plus_one_control-0.6.0 lib/n_plus_one_control/rspec/dsl.rb
n_plus_one_control-0.5.0 lib/n_plus_one_control/rspec/dsl.rb
n_plus_one_control-0.4.1 lib/n_plus_one_control/rspec/dsl.rb
n_plus_one_control-0.4.0 lib/n_plus_one_control/rspec/dsl.rb