Sha256: 5206c2273e8759c04eb8197024675995e2eb0b5ab08ef95249711ff963cad1c3

Contents?: true

Size: 773 Bytes

Versions: 186

Compression:

Stored size: 773 Bytes

Contents

require 'mspec/runner/mspec'

# Holds some of the state of the example (i.e. +it+ block) that is
# being evaluated. See also +ContextState+.
class ExampleState
  attr_reader   :context, :it, :example

  def initialize(context, it, example=nil)
    @context  = context
    @it       = it
    @example  = example
  end

  def context=(context)
    @description = nil
    @context = context
  end

  def describe
    @context.description
  end

  def description
    @description ||= "#{describe} #{@it}"
  end

  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
end

Version data entries

186 entries across 162 versions & 4 rubygems

Version Path
mspec-1.5.5 lib/mspec/runner/example.rb
mspec-1.5.8 lib/mspec/runner/example.rb
mspec-1.5.9 lib/mspec/runner/example.rb
mspec-1.5.6 lib/mspec/runner/example.rb
rhodes-framework-1.1.1 spec/app/mspec/runner/example.rb
rhodes-framework-1.1.0 spec/app/mspec/runner/example.rb