Class: Spectus::ExpectationTarget
- Inherits:
-
Object
- Object
- Spectus::ExpectationTarget
- Defined in:
- lib/spectus/expectation_target.rb
Overview
Wraps the target of an expectation.
Instance Method Summary collapse
-
#initialize(&callable) ⇒ ExpectationTarget
constructor
Create a new expectation target.
-
#MAY(matcher) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This word, or the adjective “OPTIONAL”, mean that an item is truly optional.
- #MAY!(matcher) ⇒ Object
-
#MUST(matcher) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This word, or the terms “REQUIRED” or “SHALL”, mean that the definition is an absolute requirement of the specification.
- #MUST!(matcher) ⇒ Object
-
#MUST_NOT(matcher) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This phrase, or the phrase “SHALL NOT”, mean that the definition is an absolute prohibition of the specification.
- #MUST_NOT!(matcher) ⇒ Object
-
#SHOULD(matcher) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This word, or the adjective “RECOMMENDED”, 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) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This phrase, or the phrase “NOT RECOMMENDED” 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
Constructor Details
#initialize(&callable) ⇒ ExpectationTarget
Create a new expectation target
12 13 14 |
# File 'lib/spectus/expectation_target.rb', line 12 def initialize(&callable) @callable = callable end |
Instance Method Details
#MAY(matcher) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This word, or the adjective “OPTIONAL”, 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.)
169 170 171 172 173 174 175 176 |
# File 'lib/spectus/expectation_target.rb', line 169 def MAY(matcher) RequirementLevel::May.new( callable: callable, isolation: false, negate: false, matcher: matcher ).call end |
#MAY!(matcher) ⇒ Object
182 183 184 185 186 187 188 189 |
# File 'lib/spectus/expectation_target.rb', line 182 def MAY!(matcher) RequirementLevel::May.new( callable: callable, isolation: true, negate: false, matcher: matcher ).call end |
#MUST(matcher) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This word, or the terms “REQUIRED” or “SHALL”, mean that the definition is an absolute requirement of the specification.
28 29 30 31 32 33 34 35 |
# File 'lib/spectus/expectation_target.rb', line 28 def MUST(matcher) RequirementLevel::Must.new( callable: callable, isolation: false, negate: false, matcher: matcher ).call end |
#MUST!(matcher) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/spectus/expectation_target.rb', line 41 def MUST!(matcher) RequirementLevel::Must.new( callable: callable, isolation: true, negate: false, matcher: matcher ).call end |
#MUST_NOT(matcher) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This phrase, or the phrase “SHALL NOT”, mean that the definition is an absolute prohibition of the specification.
60 61 62 63 64 65 66 67 |
# File 'lib/spectus/expectation_target.rb', line 60 def MUST_NOT(matcher) RequirementLevel::Must.new( callable: callable, isolation: false, negate: true, matcher: matcher ).call end |
#MUST_NOT!(matcher) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/spectus/expectation_target.rb', line 73 def MUST_NOT!(matcher) RequirementLevel::Must.new( callable: callable, isolation: true, negate: true, matcher: matcher ).call end |
#SHOULD(matcher) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This word, or the adjective “RECOMMENDED”, 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.
94 95 96 97 98 99 100 101 |
# File 'lib/spectus/expectation_target.rb', line 94 def SHOULD(matcher) RequirementLevel::Should.new( callable: callable, isolation: false, negate: false, matcher: matcher ).call end |
#SHOULD!(matcher) ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/spectus/expectation_target.rb', line 107 def SHOULD!(matcher) RequirementLevel::Should.new( callable: callable, isolation: true, negate: false, matcher: matcher ).call end |
#SHOULD_NOT(matcher) ⇒ Spectus::Result::Fail, Spectus::Result::Pass
This phrase, or the phrase “NOT RECOMMENDED” 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.
129 130 131 132 133 134 135 136 |
# File 'lib/spectus/expectation_target.rb', line 129 def SHOULD_NOT(matcher) RequirementLevel::Should.new( callable: callable, isolation: false, negate: true, matcher: matcher ).call end |
#SHOULD_NOT!(matcher) ⇒ Object
142 143 144 145 146 147 148 149 |
# File 'lib/spectus/expectation_target.rb', line 142 def SHOULD_NOT!(matcher) RequirementLevel::Should.new( callable: callable, isolation: true, negate: true, matcher: matcher ).call end |