Class: RailsProof::AiTestExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_proof/ai_test_executor.rb

Defined Under Namespace

Classes: Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root:, test_file_path:, test_class_name:, superclass:, concerns:, target_path: nil, runner_class: RailsProof::TestRunner, review_store: nil) ⇒ AiTestExecutor

Returns a new instance of AiTestExecutor.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/rails_proof/ai_test_executor.rb', line 45

def initialize(
  root:,
  test_file_path:,
  test_class_name:,
  superclass:,
  concerns:,
  target_path: nil,
  runner_class: RailsProof::TestRunner,
  review_store: nil
)
  @root = Pathname.new(root)
  @target_path = target_path
  @test_file_path = test_file_path
  @test_class_name = test_class_name
  @superclass = superclass
  @concerns = concerns
  @runner_class = runner_class
  @review_store = review_store ||
    RailsProof::ReviewStore.new(root: @root)
end

Instance Attribute Details

#concernsObject (readonly)

Returns the value of attribute concerns.



36
37
38
# File 'lib/rails_proof/ai_test_executor.rb', line 36

def concerns
  @concerns
end

#review_storeObject (readonly)

Returns the value of attribute review_store.



36
37
38
# File 'lib/rails_proof/ai_test_executor.rb', line 36

def review_store
  @review_store
end

#rootObject (readonly)

Returns the value of attribute root.



36
37
38
# File 'lib/rails_proof/ai_test_executor.rb', line 36

def root
  @root
end

#runner_classObject (readonly)

Returns the value of attribute runner_class.



36
37
38
# File 'lib/rails_proof/ai_test_executor.rb', line 36

def runner_class
  @runner_class
end

#superclassObject (readonly)

Returns the value of attribute superclass.



36
37
38
# File 'lib/rails_proof/ai_test_executor.rb', line 36

def superclass
  @superclass
end

#target_pathObject (readonly)

Returns the value of attribute target_path.



36
37
38
# File 'lib/rails_proof/ai_test_executor.rb', line 36

def target_path
  @target_path
end

#test_class_nameObject (readonly)

Returns the value of attribute test_class_name.



36
37
38
# File 'lib/rails_proof/ai_test_executor.rb', line 36

def test_class_name
  @test_class_name
end

#test_file_pathObject (readonly)

Returns the value of attribute test_file_path.



36
37
38
# File 'lib/rails_proof/ai_test_executor.rb', line 36

def test_file_path
  @test_file_path
end

Instance Method Details

#executeObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/rails_proof/ai_test_executor.rb', line 66

def execute
  filter = RailsProof::AiConcernFilter.new(
    concerns: concerns,
    existing_tests: existing_test_source,
    review_findings: outstanding_review_findings
  )

  results = filter.concerns.map do |concern|
    execute_concern(concern)
  end

  results.concat(
    filter.skipped.map do |skipped|
      skipped_result(skipped)
    end
  )

  results
end