Class: Reeve::Testing::Checks::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/reeve/testing/checks/base.rb

Overview

What every check shares: a tool, a way to invoke it, a window onto the ledger, and the vocabulary its failure messages are written in.

Plain Ruby, deliberately. Nothing under checks/ may reference RSpec or Minitest, because the whole point of this layer is that a rake task, a deploy gate or a boot-time assertion can run it with neither framework installed (FR-026).

Defined Under Namespace

Classes: Attempt

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tool: nil, arguments: {}, invoke: nil, ledger: nil) ⇒ Base

Returns a new instance of Base.



34
35
36
37
38
39
# File 'lib/reeve/testing/checks/base.rb', line 34

def initialize(tool: nil, arguments: {}, invoke: nil, ledger: nil)
  @tool      = tool
  @arguments = arguments
  @invoke    = invoke || Reeve.method(:invoke)
  @ledger    = ledger || Ledger.default
end

Class Method Details

.check_nameObject



30
31
32
# File 'lib/reeve/testing/checks/base.rb', line 30

def self.check_name
  name.to_s.split("::").last
end

Instance Method Details

#callObject

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/reeve/testing/checks/base.rb', line 41

def call
  raise NotImplementedError, "#{self.class} must implement #call"
end

#check_nameObject



45
46
47
# File 'lib/reeve/testing/checks/base.rb', line 45

def check_name
  self.class.check_name
end