Class: RailsAiBridge::Doctor::Checkers::TestsChecker

Inherits:
BaseChecker
  • Object
show all
Defined in:
lib/rails_ai_bridge/doctor/checkers/tests_checker.rb

Overview

Verifies a +spec+ or +test+ directory exists.

Instance Attribute Summary

Attributes inherited from BaseChecker

#app

Instance Method Summary collapse

Methods inherited from BaseChecker

#initialize

Constructor Details

This class inherits a constructor from RailsAiBridge::Doctor::Checkers::BaseChecker

Instance Method Details

#callDoctor::Check

Returns +:pass+ when a test tree exists; +:warn+ otherwise.

Returns:

  • (Doctor::Check)

    +:pass+ when a test tree exists; +:warn+ otherwise



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rails_ai_bridge/doctor/checkers/tests_checker.rb', line 9

def call
  spec_dir = File.join(app.root, 'spec')
  test_dir = File.join(app.root, 'test')
  framework = Dir.exist?(spec_dir) ? 'RSpec' : 'Minitest'

  check(
    'Tests',
    Dir.exist?(spec_dir) || Dir.exist?(test_dir),
    pass: { message: "#{framework} test directory found" },
    fail: { status: :warn, message: 'No test directory found',
            fix: 'Set up tests with `rails generate rspec:install` or use default Minitest' }
  )
end