Parent

Class/Module Index [+]

Quicksearch

Spec::Matchers::SimpleMatcher

Attributes

description[W]
failure_message[W]
negative_failure_message[W]

Public Class Methods

new(description, &match_block) click to toggle source
# File lib/spec/matchers/simple_matcher.rb, line 6
def initialize(description, &match_block)
  @description = description
  @match_block = match_block
  @failure_message = @negative_failure_message = nil
end

Public Instance Methods

description() click to toggle source
# File lib/spec/matchers/simple_matcher.rb, line 22
def description
  @description || explanation
end
explanation() click to toggle source
# File lib/spec/matchers/simple_matcher.rb, line 34
def explanation
  "No description provided. See RDoc for simple_matcher()"
end
failure_message_for_should() click to toggle source
# File lib/spec/matchers/simple_matcher.rb, line 26
def failure_message_for_should
  @failure_message || (@description.nil? ? explanation : %[expected #{@description.inspect} but got #{@given.inspect}])
end
failure_message_for_should_not() click to toggle source
# File lib/spec/matchers/simple_matcher.rb, line 30
def failure_message_for_should_not
  @negative_failure_message || (@description.nil? ? explanation : %[expected not to get #{@description.inspect}, but got #{@given.inspect}])
end
matches?(given) click to toggle source
# File lib/spec/matchers/simple_matcher.rb, line 12
def matches?(given)
  @given = given
  case @match_block.arity
  when 2
    @match_block.call(@given, self)
  else
    @match_block.call(@given)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.