Methods
public class
public instance
Included modules
Attributes
| actual | [R] | |
| expected | [R] |
Public class methods
new
(name, *expected, &declarations)
[show source]
# File lib/spec/matchers/matcher.rb, line 8 def initialize(name, *expected, &declarations) @name = name @expected = expected @diffable = false @messages = { :description => lambda {"#{name_to_sentence}#{expected_to_sentence}"}, :failure_message_for_should => lambda {|actual| "expected #{actual.inspect} to #{name_to_sentence}#{expected_to_sentence}"}, :failure_message_for_should_not => lambda {|actual| "expected #{actual.inspect} not to #{name_to_sentence}#{expected_to_sentence}"} } making_declared_methods_public do instance_exec(*@expected, &declarations) end end
Public instance methods
description
(&block)
[show source]
# File lib/spec/matchers/matcher.rb, line 27 def description(&block) cache_or_call_cached(:description, &block) end
diffable
()
[show source]
# File lib/spec/matchers/matcher.rb, line 47 def diffable @diffable = true end
failure_message_for_should
(&block)
[show source]
# File lib/spec/matchers/matcher.rb, line 31 def failure_message_for_should(&block) cache_or_call_cached(:failure_message_for_should, @actual, &block) end
failure_message_for_should_not
(&block)
[show source]
# File lib/spec/matchers/matcher.rb, line 35 def failure_message_for_should_not(&block) cache_or_call_cached(:failure_message_for_should_not, @actual, &block) end
match
(&block)
[show source]
# File lib/spec/matchers/matcher.rb, line 39 def match(&block) @match_block = block end
matches?
(actual)
[show source]
# File lib/spec/matchers/matcher.rb, line 22 def matches?(actual) @actual = actual instance_exec(@actual, &@match_block) end