Class: TestProf::LetItBe::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#report_duplicatesObject

Returns the value of attribute report_duplicates.



19
20
21
# File 'lib/test_prof/recipes/rspec/let_it_be.rb', line 19

def report_duplicates
  @report_duplicates
end

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


26
27
28
# File 'lib/test_prof/recipes/rspec/let_it_be.rb', line 26

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

#default_modifiersObject



39
40
41
# File 'lib/test_prof/recipes/rspec/let_it_be.rb', line 39

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)


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

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