Module: ActionAI::TestCase::Behavior::ClassMethods

Defined in:
lib/action_ai/test_case.rb

Instance Method Summary collapse

Instance Method Details

#agent_classObject



59
60
61
62
# File 'lib/action_ai/test_case.rb', line 59

def agent_class
  _agent_class or
    tests determine_default_agent(name)
end

#determine_default_agent(name) ⇒ Object



64
65
66
67
68
69
# File 'lib/action_ai/test_case.rb', line 64

def determine_default_agent(name)
  determine_constant_from_test_name(name) do |constant|
    Class === constant && constant < ActionAI::Agent
  end or
    raise NonInferrableAgentError.new(name)
end

#tests(agent) ⇒ Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/action_ai/test_case.rb', line 48

def tests(agent)
  case agent
  when String, Symbol
    self._agent_class = agent.to_s.camelize.constantize
  when Module
    self._agent_class = agent
  else
    raise NonInferrableAgentError.new(agent)
  end
end