Module: ActionAI::TestCase::Behavior

Extended by:
ActiveSupport::Concern
Includes:
ActionAI::TestHelper, ActiveSupport::Testing::ConstantLookup, Rails::Dom::Testing::Assertions::DomAssertions, Rails::Dom::Testing::Assertions::SelectorAssertions
Included in:
ActionAI::TestCase
Defined in:
lib/action_ai/test_case.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from ActionAI::TestHelper

#assert_ai_prompts, #assert_enqueued_ai_job_with, #assert_enqueued_ai_jobs, #assert_no_ai_prompts, #assert_no_enqueued_ai_jobs, #capture_ai_prompts, #perform_enqueued_ai_jobs

Instance Method Details

#read_fixture(action) ⇒ Object

Reads the fixture file for the given agent.

This is useful when testing agents by being able to write the body of a prompt inside a fixture. See the testing guide for a concrete example: guides.rubyonrails.org/testing.html#revenge-of-the-fixtures



77
78
79
# File 'lib/action_ai/test_case.rb', line 77

def read_fixture(action)
  IO.readlines(File.join(Rails.root, "test", "fixtures", self.class.agent_class.name.underscore, action))
end