class RSpec::SleepingKingStudios::Configuration::Matchers

Configuration options for RSpec::SleepingKingStudios::Matchers.

Public Instance Methods

allow_empty_include_matchers() click to toggle source

Checks whether the include matcher can be instantiated without an expectation object or block.

@return [Boolean] True if the empty include matchers are permitted,

otherwise false.
# File lib/rspec/sleeping_king_studios/configuration.rb, line 80
def allow_empty_include_matchers
  value = @allow_empty_include_matchers

  value.nil? ? true : value
end
allow_empty_include_matchers=(value) click to toggle source

Sets whether the include matcher can be instantiated without an expectation object or block. If this option is set to false, an ArgumentError will be raised when attempting to instantiate an IncludeMatcher without any expectations.

This prevents an insidious bug when using the do..end block syntax to create a block expectation while the matcher macro is itself an argument to another function, such as ExpectationTarget#to. This bug causes the block to be silently ignored and any enumerable object to match against the matcher, even an empty object.

@return [Boolean] True if the empty include matchers are permitted,

otherwise false.
# File lib/rspec/sleeping_king_studios/configuration.rb, line 100
def allow_empty_include_matchers= value
  @allow_empty_include_matchers = !!value
end
allow_empty_include_matchers?()
strict_predicate_matching() click to toggle source

Checks whether predicates are matched “strictly”, meaning that they must return either true or false.

@return [Boolean] True if predicates are strictly matched, otherwise

false.
# File lib/rspec/sleeping_king_studios/configuration.rb, line 109
def strict_predicate_matching
  @strict_predicate_matching ||= false
end
Also aliased as: strict_predicate_matching?
strict_predicate_matching=(value) click to toggle source

Sets whether predicates are matched “strictly”, meaning that they must return either true or false.

@param [Boolean] value The desired value. Is coerced to true or false.

# File lib/rspec/sleeping_king_studios/configuration.rb, line 118
def strict_predicate_matching= value
  @strict_predicate_matching = !!value
end
strict_predicate_matching?()