Module: Minitest::OpenAPI::RunPatch

Defined in:
lib/minitest/openapi/minitest_hook.rb

Instance Method Summary collapse

Instance Method Details

#run(*args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/minitest/openapi/minitest_hook.rb', line 10

def run(*args)
  return super unless ENV["DOC"]
  result = super

  if self.class.document?
    test_file_path = result.source_location.first
    test_case = TestCase.new(test_file_path)
     = Minitest::OpenAPI::EndpointMetadata.call(self, test_case) || {}

    self.webhook? ?
      Minitest::OpenAPI::Webhook.build(, test_case) :
      Minitest::OpenAPI::Path.build(, test_case)
  end

  result
end