class ArgumentSpecification::Matchers::Satisfy
Attributes
description[R]
Public Class Methods
new(description)
click to toggle source
Create a new matcher instance
Arguments:
description: (String)
Example:
>> ArgumentSpecification::Matchers::Satisfy.new('always pass') => #<ArgumentSpecification::Matchers::Satisfy:0x00000000000000 @block=#<Proc:0x00000000000000>>
# File lib/argspec/matchers/satisfy.rb, line 17 def initialize(description) @description = description end
Public Instance Methods
failure_message()
click to toggle source
The failure message when using ‘should’
Example:
>> matcher.failure_message => "'test' should always pass"
# File lib/argspec/matchers/satisfy.rb, line 27 def failure_message actual = prettify_args(@actual) if @description "'#{actual}' should #{@description}" else "'#{actual}' should satisfy the requirements" end end
failure_message_when_negated()
click to toggle source
The failure message when using ‘should not’
Example:
>> matcher.failure_message_when_negated => "':test' should not always pass"
# File lib/argspec/matchers/satisfy.rb, line 43 def failure_message_when_negated actual = prettify_args(@actual) if @description "'#{actual}' should not #{@description}" else "'#{actual}' should not satisfy the requirements" end end
matches?()
click to toggle source
Check if the actual object matches
Example:
>> matcher.matches? => true
# File lib/argspec/matchers/satisfy.rb, line 59 def matches? return @block.call(@actual) if @block false end