Method: ContextState#initialize

Defined in:
lib/mspec/runner/context.rb

#initialize(mod, options = nil) ⇒ ContextState

Returns a new instance of ContextState.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/mspec/runner/context.rb', line 18

def initialize(mod, options=nil)
  @to_s = mod.to_s
  if options.is_a? Hash
    @options = options
  else
    @to_s += "#{".:#".include?(options[0,1]) ? "" : " "}#{options}" if options
    @options = { }
  end
  @options[:shared] ||= false

  @parsed   = false
  @before   = { :all => [], :each => [] }
  @after    = { :all => [], :each => [] }
  @pre      = {}
  @post     = {}
  @examples = []
  @parent   = nil
  @parents  = [self]
  @children = []

  @mock_verify         = lambda { Mock.verify_count }
  @mock_cleanup        = lambda { Mock.cleanup }
  @expectation_missing = lambda { raise ExpectationNotFoundError }
end