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
rhodes-5.5.18 lib/extensions/mspec/mspec/runner/example.rb
rhodes-5.5.17 lib/extensions/mspec/mspec/runner/example.rb
rhodes-5.5.15 lib/extensions/mspec/mspec/runner/example.rb
rhodes-5.5.0.22 lib/extensions/mspec/mspec/runner/example.rb
rhodes-5.5.2 lib/extensions/mspec/mspec/runner/example.rb
rhodes-5.5.0.7 lib/extensions/mspec/mspec/runner/example.rb
rhodes-5.5.0.3 lib/extensions/mspec/mspec/runner/example.rb
rhodes-5.5.0 lib/extensions/mspec/mspec/runner/example.rb
tauplatform-1.0.3 lib/extensions/mspec/mspec/runner/example.rb
mspec-1.9.1 lib/mspec/runner/example.rb
mspec-1.9.0 lib/mspec/runner/example.rb
tauplatform-1.0.2 lib/extensions/mspec/mspec/runner/example.rb
tauplatform-1.0.1 lib/extensions/mspec/mspec/runner/example.rb
mspec-1.8.0 lib/mspec/runner/example.rb
mspec-1.7.0 lib/mspec/runner/example.rb
mspec-1.6.0 lib/mspec/runner/example.rb
mspec-1.5.21 lib/mspec/runner/example.rb
mspec-1.5.20 lib/mspec/runner/example.rb
mspec-1.5.19 lib/mspec/runner/example.rb
mspec-1.5.18 lib/mspec/runner/example.rb