Class: RailsAiBridge::Doctor::Checkers::ViewsChecker

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

Overview

Verifies +app/views+ contains template files.

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 view files exist; +:warn+ otherwise.

Returns:

  • (Doctor::Check)

    +:pass+ when view files exist; +:warn+ otherwise



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

def call
  views_path = File.join(app.root, 'app/views', '**/*')
  views = Dir.glob(views_path).reject { |f| File.directory?(f) }

  check(
    'Views',
    views.any?,
    pass: { message: "#{views.size} view files found" },
    fail: { status: :warn, message: 'No view files found in app/views/',
            fix: 'Views are generated alongside controllers' }
  )
end