Module: NPlusOneControl::RSpec::DSL::ClassMethods

Defined in:
lib/n_plus_one_control/rspec/dsl.rb

Overview

Extends RSpec ExampleGroup with populate & warmup methods

Instance Method Summary collapse

Instance Method Details

#populate(&block) ⇒ Object

Setup populate callback, which is used to prepare data for each run.



20
21
22
23
24
# File 'lib/n_plus_one_control/rspec/dsl.rb', line 20

def populate(&block)
  return @populate unless block

  @populate = block
end

#warmup(&block) ⇒ Object

Setup warmup block, which will run before matching for example, if using cache, then later queries will perform less DB queries than first



12
13
14
15
16
# File 'lib/n_plus_one_control/rspec/dsl.rb', line 12

def warmup(&block)
  return @warmup unless block

  @warmup = block
end