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.
- .may!(matcher) ⇒ Object
-
.must(matcher) ⇒ Requirement::Required
This method mean that the definition is an absolute requirement of the specification.
- .must!(matcher) ⇒ Object
-
.must_not(matcher) ⇒ Requirement::Required
This method mean that the definition is an absolute prohibition of the specification.
- .must_not!(matcher) ⇒ Object
-
.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!(matcher) ⇒ Object
-
.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.
- .should_not!(matcher) ⇒ Object
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).
184 185 186 187 188 189 190 |
# File 'lib/spectus.rb', line 184 def self.may(matcher) Requirement::Optional.new( isolate: false, negate: false, matcher: matcher ) end |
.may!(matcher) ⇒ Object
200 201 202 203 204 205 206 |
# File 'lib/spectus.rb', line 200 def self.may!(matcher) Requirement::Optional.new( isolate: true, negate: false, matcher: matcher ) end |
.must(matcher) ⇒ Requirement::Required
This method mean that the definition is an absolute requirement of the specification.
25 26 27 28 29 30 31 |
# File 'lib/spectus.rb', line 25 def self.must(matcher) Requirement::Required.new( isolate: false, negate: false, matcher: matcher ) end |
.must!(matcher) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/spectus.rb', line 41 def self.must!(matcher) Requirement::Required.new( isolate: true, negate: false, matcher: matcher ) end |
.must_not(matcher) ⇒ Requirement::Required
This method mean that the definition is an absolute prohibition of the specification.
61 62 63 64 65 66 67 |
# File 'lib/spectus.rb', line 61 def self.must_not(matcher) Requirement::Required.new( isolate: false, negate: true, matcher: matcher ) end |
.must_not!(matcher) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/spectus.rb', line 77 def self.must_not!(matcher) Requirement::Required.new( isolate: true, negate: true, matcher: 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.
99 100 101 102 103 104 105 |
# File 'lib/spectus.rb', line 99 def self.should(matcher) Requirement::Recommended.new( isolate: false, negate: false, matcher: matcher ) end |
.should!(matcher) ⇒ Object
115 116 117 118 119 120 121 |
# File 'lib/spectus.rb', line 115 def self.should!(matcher) Requirement::Recommended.new( isolate: true, negate: false, matcher: 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.
139 140 141 142 143 144 145 |
# File 'lib/spectus.rb', line 139 def self.should_not(matcher) Requirement::Recommended.new( isolate: false, negate: true, matcher: matcher ) end |
.should_not!(matcher) ⇒ Object
155 156 157 158 159 160 161 |
# File 'lib/spectus.rb', line 155 def self.should_not!(matcher) Requirement::Recommended.new( isolate: true, negate: true, matcher: matcher ) end |