Class: TestProf::LetItBe::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/test_prof/recipes/rspec/let_it_be.rb

Instance Method Summary collapse

Instance Method Details

#alias_to(name, **default_args) ⇒ Object

Define an alias for ‘let_it_be` with the predefined options:

TestProf::LetItBe.configure do |config|
  config.alias_to :let_it_be_reloaded, reload: true
end


22
23
24
# File 'lib/test_prof/recipes/rspec/let_it_be.rb', line 22

def alias_to(name, **default_args)
  LetItBe.define_let_it_be_alias(name, **default_args)
end

#default_modifiersObject



35
36
37
# File 'lib/test_prof/recipes/rspec/let_it_be.rb', line 35

def default_modifiers
  @default_modifiers ||= {}
end

#register_modifier(key, on: :let, &block) ⇒ Object

Register modifier by providing the name of key, optional scope (when to apply the modifier, on initialization (:initialize) or when accessed # via let (:let))

Raises:

  • (ArgumentError)


29
30
31
32
33
# File 'lib/test_prof/recipes/rspec/let_it_be.rb', line 29

def register_modifier(key, on: :let, &block)
  raise ArgumentError, "Modifier #{key} is already defined for let_it_be" if LetItBe.modifiers.key?(key)

  LetItBe.modifiers[key] = Modifier.new(on, block)
end