Class: RSpec::SleepingKingStudios::Configuration::Matchers
- Inherits:
-
Object
- Object
- RSpec::SleepingKingStudios::Configuration::Matchers
- Defined in:
- lib/rspec/sleeping_king_studios/configuration.rb
Overview
Configuration options for RSpec::SleepingKingStudios::Matchers.
Instance Method Summary collapse
-
#allow_empty_include_matchers ⇒ Boolean
(also: #allow_empty_include_matchers?)
Checks whether the #include matcher can be instantiated without an expectation object or block.
-
#allow_empty_include_matchers=(value) ⇒ Boolean
Sets whether the #include matcher can be instantiated without an expectation object or block.
-
#strict_predicate_matching ⇒ Boolean
(also: #strict_predicate_matching?)
Checks whether predicates are matched “strictly”, meaning that they must return either true or false.
-
#strict_predicate_matching=(value) ⇒ Object
Sets whether predicates are matched “strictly”, meaning that they must return either true or false.
Instance Method Details
#allow_empty_include_matchers ⇒ Boolean Also known as: allow_empty_include_matchers?
Checks whether the #include matcher can be instantiated without an expectation object or block.
80 81 82 83 84 |
# 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) ⇒ Boolean
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.
100 101 102 |
# File 'lib/rspec/sleeping_king_studios/configuration.rb', line 100 def allow_empty_include_matchers= value @allow_empty_include_matchers = !!value end |
#strict_predicate_matching ⇒ Boolean Also known as: strict_predicate_matching?
Checks whether predicates are matched “strictly”, meaning that they must return either true or false.
109 110 111 |
# File 'lib/rspec/sleeping_king_studios/configuration.rb', line 109 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.
118 119 120 |
# File 'lib/rspec/sleeping_king_studios/configuration.rb', line 118 def strict_predicate_matching= value @strict_predicate_matching = !!value end |