Class: RSpec::SleepingKingStudios::Configuration::Matchers

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/sleeping_king_studios/configuration.rb

Overview

Configuration options for RSpec::SleepingKingStudios::Matchers.

Instance Method Summary collapse

Instance Method Details

#allow_empty_include_matchersBoolean Also known as: allow_empty_include_matchers?

Deprecated.
3.0

Will be removed in version 3.0.

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

Returns:

  • (Boolean)

    True if the empty include matchers are permitted, otherwise false.



86
87
88
89
90
# File 'lib/rspec/sleeping_king_studios/configuration.rb', line 86

def allow_empty_include_matchers
  value = @allow_empty_include_matchers

  value.nil? ? true : value # rubocop:disable Style/RedundantCondition
end

#allow_empty_include_matchers=(value) ⇒ Boolean

Deprecated.
3.0

Will be removed in version 3.0.

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.

Returns:

  • (Boolean)

    True if the empty include matchers are permitted, otherwise false.



108
109
110
# File 'lib/rspec/sleeping_king_studios/configuration.rb', line 108

def allow_empty_include_matchers=(value)
  @allow_empty_include_matchers = !!value
end

#strict_predicate_matchingBoolean Also known as: strict_predicate_matching?

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

Returns:

  • (Boolean)

    True if predicates are strictly matched, otherwise false.



117
118
119
# File 'lib/rspec/sleeping_king_studios/configuration.rb', line 117

def strict_predicate_matching
  @strict_predicate_matching ||= false
end

#strict_predicate_matching=(value) ⇒ Object

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

Parameters:

  • value (Boolean)

    The desired value. Is coerced to true or false.



126
127
128
# File 'lib/rspec/sleeping_king_studios/configuration.rb', line 126

def strict_predicate_matching=(value)
  @strict_predicate_matching = !!value
end