Class: Crspec::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/crspec/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
17
18
19
# File 'lib/crspec/configuration.rb', line 10

def initialize
  @concurrency = Etc.nprocessors
  @use_transactional_fixtures = true
  @formatter = nil
  @before_hooks = []
  @after_hooks = []
  @around_hooks = []
  @included_modules = []
  @infer_spec_type = false
end

Instance Attribute Details

#after_hooksObject (readonly)

Returns the value of attribute after_hooks.



8
9
10
# File 'lib/crspec/configuration.rb', line 8

def after_hooks
  @after_hooks
end

#around_hooksObject (readonly)

Returns the value of attribute around_hooks.



8
9
10
# File 'lib/crspec/configuration.rb', line 8

def around_hooks
  @around_hooks
end

#before_hooksObject (readonly)

Returns the value of attribute before_hooks.



8
9
10
# File 'lib/crspec/configuration.rb', line 8

def before_hooks
  @before_hooks
end

#concurrencyObject

Returns the value of attribute concurrency.



7
8
9
# File 'lib/crspec/configuration.rb', line 7

def concurrency
  @concurrency
end

#formatterObject

Returns the value of attribute formatter.



7
8
9
# File 'lib/crspec/configuration.rb', line 7

def formatter
  @formatter
end

#included_modulesObject (readonly)

Returns the value of attribute included_modules.



8
9
10
# File 'lib/crspec/configuration.rb', line 8

def included_modules
  @included_modules
end

#use_transactional_fixturesObject

Returns the value of attribute use_transactional_fixtures.



7
8
9
# File 'lib/crspec/configuration.rb', line 7

def use_transactional_fixtures
  @use_transactional_fixtures
end

Instance Method Details

#after(_scope = :each, &block) ⇒ Object



25
26
27
# File 'lib/crspec/configuration.rb', line 25

def after(_scope = :each, &block)
  @after_hooks.unshift(block)
end

#around(_scope = :each, &block) ⇒ Object



29
30
31
# File 'lib/crspec/configuration.rb', line 29

def around(_scope = :each, &block)
  @around_hooks << block
end

#before(_scope = :each, &block) ⇒ Object



21
22
23
# File 'lib/crspec/configuration.rb', line 21

def before(_scope = :each, &block)
  @before_hooks << block
end

#include(mod) ⇒ Object



33
34
35
# File 'lib/crspec/configuration.rb', line 33

def include(mod)
  @included_modules << mod
end

#infer_spec_type?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/crspec/configuration.rb', line 41

def infer_spec_type?
  !!@infer_spec_type
end

#infer_spec_type_from_file_location!Object



37
38
39
# File 'lib/crspec/configuration.rb', line 37

def infer_spec_type_from_file_location!
  @infer_spec_type = true
end