Module: Omnibot::Testing

Defined in:
lib/omnibot/testing.rb

Defined Under Namespace

Modules: Helpers Classes: FakeChat, FakeMessage, FakeTokens, FakeToolCall, StubBuilder

Class Method Summary collapse

Class Method Details

.fake!Object



8
9
10
11
12
13
# File 'lib/omnibot/testing.rb', line 8

def fake!
  @original_factory ||= Omnibot.chat_factory
  Omnibot.chat_factory = ->(model:, agent_class: nil, **) {
    FakeChat.new(agent_class: agent_class)
  }
end

.reset!Object



15
16
17
18
19
# File 'lib/omnibot/testing.rb', line 15

def reset!
  Omnibot.chat_factory = @original_factory if @original_factory
  @original_factory = nil
  scripts.clear
end

.script_for(agent_class) ⇒ Object



22
# File 'lib/omnibot/testing.rb', line 22

def script_for(agent_class) = scripts[agent_class] ||= []

.scriptsObject



21
# File 'lib/omnibot/testing.rb', line 21

def scripts = @scripts ||= {}