Class: Spec::DSL::ExampleMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/spec/dsl/example_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(behaviour_desc, example_desc = nil) ⇒ ExampleMatcher

Returns a new instance of ExampleMatcher.



6
7
8
9
# File 'lib/spec/dsl/example_matcher.rb', line 6

def initialize(behaviour_desc, example_desc=nil)
  @behaviour_desc = behaviour_desc
  @example_desc = example_desc
end

Instance Attribute Details

#example_desc=(value) ⇒ Object (writeonly)

Sets the attribute example_desc

Parameters:

  • value

    the value to set the attribute example_desc to.



5
6
7
# File 'lib/spec/dsl/example_matcher.rb', line 5

def example_desc=(value)
  @example_desc = value
end

Instance Method Details

#matches?(specified_examples) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
# File 'lib/spec/dsl/example_matcher.rb', line 11

def matches?(specified_examples)
  specified_examples.each do |specified_example|
    return true if matches_literal_example?(specified_example) || matches_example_not_considering_modules?(specified_example)
  end
  false
end