Module: Spectus
- Defined in:
- lib/spectus.rb,
lib/spectus/requirement.rb,
lib/spectus/requirement/base.rb,
lib/spectus/requirement/optional.rb,
lib/spectus/requirement/required.rb,
lib/spectus/requirement/recommended.rb
Overview
Namespace for the Spectus library.
This module defines methods that can be used to qualify expectations in specifications.
Defined Under Namespace
Modules: Requirement
Class Method Summary collapse
-
.may(matcher) ⇒ Requirement::Optional
This method mean that an item is truly optional.
-
.must(matcher) ⇒ Requirement::Required
This method mean that the definition is an absolute requirement of the specification.
-
.must_not(matcher) ⇒ Requirement::Required
This method mean that the definition is an absolute prohibition of the specification.
-
.should(matcher) ⇒ Requirement::Recommended
This method mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.
-
.should_not(matcher) ⇒ Requirement::Recommended
This method mean that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label.
Class Method Details
.may(matcher) ⇒ Requirement::Optional
This method mean that an item is truly optional. One vendor may choose to include the item because a particular marketplace requires it or because the vendor feels that it enhances the product while another vendor may omit the same item. An implementation which does not include a particular option must be prepared to interoperate with another implementation which does include the option, though perhaps with reduced functionality. In the same vein an implementation which does include a particular option must be prepared to interoperate with another implementation which does not include the option (except, of course, for the feature the option provides).
104 105 106 |
# File 'lib/spectus.rb', line 104 def self.may(matcher) Requirement::Optional.new(negate: false, matcher:) end |
.must(matcher) ⇒ Requirement::Required
This method mean that the definition is an absolute requirement of the specification.
25 26 27 |
# File 'lib/spectus.rb', line 25 def self.must(matcher) Requirement::Required.new(negate: false, matcher:) end |
.must_not(matcher) ⇒ Requirement::Required
This method mean that the definition is an absolute prohibition of the specification.
41 42 43 |
# File 'lib/spectus.rb', line 41 def self.must_not(matcher) Requirement::Required.new(negate: true, matcher:) end |
.should(matcher) ⇒ Requirement::Recommended
This method mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.
59 60 61 |
# File 'lib/spectus.rb', line 59 def self.should(matcher) Requirement::Recommended.new(negate: false, matcher:) end |
.should_not(matcher) ⇒ Requirement::Recommended
This method mean that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label.
79 80 81 |
# File 'lib/spectus.rb', line 79 def self.should_not(matcher) Requirement::Recommended.new(negate: true, matcher:) end |