Class: RailsAiBridge::Introspectors::TestIntrospector

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_ai_bridge/introspectors/test_introspector.rb

Overview

Discovers test infrastructure: framework, factories/fixtures, system tests, helpers, CI config, coverage.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ TestIntrospector

Returns a new instance of TestIntrospector.

Parameters:

  • app (Rails::Application)

    the Rails application to introspect



11
12
13
# File 'lib/rails_ai_bridge/introspectors/test_introspector.rb', line 11

def initialize(app)
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



8
9
10
# File 'lib/rails_ai_bridge/introspectors/test_introspector.rb', line 8

def app
  @app
end

Instance Method Details

#callHash

Discovers test infrastructure: framework (rspec/minitest), factories, fixtures, system tests, helpers, VCR cassettes, CI config, and coverage.

Returns:

  • (Hash)

    with :framework, :factories, :fixtures, :system_tests, :test_helpers, :vcr_cassettes, :ci_config, and :coverage on success; { error: String } on any rescued StandardError



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rails_ai_bridge/introspectors/test_introspector.rb', line 22

def call
  {
    framework: detect_framework,
    factories: detect_factories,
    fixtures: detect_fixtures,
    system_tests: detect_system_tests,
    test_helpers: detect_test_helpers,
    vcr_cassettes: detect_vcr,
    ci_config: detect_ci,
    coverage: detect_coverage
  }
rescue StandardError => error
  { error: error.message }
end