lib/spectus/expectation_target.rb in spectus-2.8.0 vs lib/spectus/expectation_target.rb in spectus-2.9.0

- old
+ new

@@ -37,10 +37,18 @@ # @return [Result::Fail, Result::Pass] Report if the spec pass or fail. def MUST(req) RequirementLevel::High.new(req, false, subject, *challenges).result end + # @example _Absolute requirement_ definition with isolation + # this { 'foo'.upcase }.MUST! Eql: 'FOO' + # + # @see MUST + def MUST!(req) + RequirementLevel::High.new(req, false, subject, *challenges).result(true) + end + # This phrase, or the phrase "SHALL NOT", mean that the # definition is an absolute prohibition of the specification. # # @example _Absolute prohibition_ definition # this { 'foo'.size }.MUST_NOT Equal: 42 @@ -50,10 +58,18 @@ # @return [Result::Fail, Result::Pass] Report if the spec pass or fail. def MUST_NOT(req) RequirementLevel::High.new(req, true, subject, *challenges).result end + # @example _Absolute prohibition_ definition with isolation + # this { 'foo'.size }.MUST_NOT! Equal: 42 + # + # @see MUST_NOT + def MUST_NOT!(req) + RequirementLevel::High.new(req, true, subject, *challenges).result(true) + end + # 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. # @@ -65,10 +81,19 @@ # @return [Result::Fail, Result::Pass] Report if the spec pass or fail. def SHOULD(req) RequirementLevel::Medium.new(req, false, subject, *challenges).result end + # @example _Recommended_ definition with isolation + # this { 'foo'.valid_encoding? }.SHOULD! Equal: true + # + # @see SHOULD + def SHOULD!(req) + RequirementLevel::Medium.new(req, false, subject, *challenges) + .result(true) + end + # 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. @@ -81,10 +106,18 @@ # @return [Result::Fail, Result::Pass] Report if the spec pass or fail. def SHOULD_NOT(req) RequirementLevel::Medium.new(req, true, subject, *challenges).result end + # @example _Not recommended_ definition with isolation + # this { ''.blank? }.SHOULD_NOT! RaiseException: NoMethodError + # + # @see SHOULD_NOT + def SHOULD_NOT!(req) + RequirementLevel::Medium.new(req, true, subject, *challenges).result(true) + end + # 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 @@ -102,11 +135,19 @@ # # @return [Result::Fail, Result::Pass] Report if the spec pass or fail. def MAY(req) RequirementLevel::Low.new(req, false, subject, *challenges).result end + + # @example _Optional_ definition with isolation + # this { 'foo'.bar }.MAY! Match: /^foo$/ + # + # @see MAY + def MAY!(req) + RequirementLevel::Low.new(req, false, subject, *challenges).result(true) + end end end -require_relative File.join 'level', 'high' -require_relative File.join 'level', 'medium' -require_relative File.join 'level', 'low' +require_relative File.join 'requirement_level', 'high' +require_relative File.join 'requirement_level', 'medium' +require_relative File.join 'requirement_level', 'low'