class ExampleState

Holds some of the state of the example (i.e. it block) that is being evaluated. See also ContextState.

Attributes

context[R]
example[R]
it[R]

Public Class Methods

new(context, it, example=nil) click to toggle source
# File lib/mspec/runner/example.rb, line 8
def initialize(context, it, example=nil)
  @context  = context
  @it       = it
  @example  = example
end

Public Instance Methods

context=(context) click to toggle source
# File lib/mspec/runner/example.rb, line 14
def context=(context)
  @description = nil
  @context = context
end
describe() click to toggle source
# File lib/mspec/runner/example.rb, line 19
def describe
  @context.description
end
description() click to toggle source
# File lib/mspec/runner/example.rb, line 23
def description
  @description ||= "#{describe} #{@it}"
end
filtered?() click to toggle source
# File lib/mspec/runner/example.rb, line 27
def filtered?
  incl = MSpec.retrieve(:include) || []
  excl = MSpec.retrieve(:exclude) || []
  included   = incl.empty? || incl.any? { |f| f === description }
  included &&= excl.empty? || !excl.any? { |f| f === description }
  not included
end