Class: Spec::Runner::SpecMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/spec/runner/spec_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context_desc, spec_desc = nil) ⇒ SpecMatcher

Returns a new instance of SpecMatcher.



6
7
8
9
# File 'lib/spec/runner/spec_matcher.rb', line 6

def initialize(context_desc, spec_desc=nil)
  @context_desc = context_desc
  @spec_desc = spec_desc
end

Instance Attribute Details

#spec_desc=(value) ⇒ Object (writeonly)

Sets the attribute spec_desc

Parameters:

  • value

    the value to set the attribute spec_desc to.



5
6
7
# File 'lib/spec/runner/spec_matcher.rb', line 5

def spec_desc=(value)
  @spec_desc = value
end

Instance Method Details

#matches?(desc) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/spec/runner/spec_matcher.rb', line 11

def matches?(desc)
  desc =~ /(^#{context_regexp} #{spec_regexp}$|^#{context_regexp}$|^#{spec_regexp}$)/
end