Class: Spectus::Requirement::Recommended

Inherits:
Base
  • Object
show all
Defined in:
lib/spectus/requirement/recommended.rb

Overview

Implementation of SHOULD/SHOULD NOT requirements from RFC 2119.

This level is less strict than MUST requirements. A test at this level passes in two cases:

  • When the matcher returns the expected result

  • When no error was raised during the test

Examples:

Testing a SHOULD requirement

test = Recommended.new(matcher: some_matcher, negate: false)
test.call { value } # Passes if matcher returns true or no error occurs

Testing a SHOULD NOT requirement

test = Recommended.new(matcher: some_matcher, negate: true)
test.call { value } # Passes if matcher returns false or no error occurs

See Also:

Class Method Summary collapse

Methods inherited from Base

#call, #initialize

Constructor Details

This class inherits a constructor from Spectus::Requirement::Base

Class Method Details

.levelSymbol

The RFC 2119 keyword for this requirement level.

Returns:

  • (Symbol)

    :SHOULD indicating a recommended requirement



28
29
30
# File 'lib/spectus/requirement/recommended.rb', line 28

def self.level
  :SHOULD
end