Module: ChatSDK::Testing::Helpers

Defined in:
lib/chat_sdk/testing/helpers.rb

Instance Method Summary collapse

Instance Method Details

#build_bot(**options) ⇒ Object



6
7
8
# File 'lib/chat_sdk/testing/helpers.rb', line 6

def build_bot(**options)
  ChatSDK::Testing.build_bot(**options)
end

#build_card(title: "Test Card", &block) ⇒ Object



26
27
28
# File 'lib/chat_sdk/testing/helpers.rb', line 26

def build_card(title: "Test Card", &block)
  ChatSDK.card(title: title, &block)
end

#build_message(text: "hello", user_id: "U123", user_name: "testuser", channel_id: "C123", thread_id: "T123") ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/chat_sdk/testing/helpers.rb', line 14

def build_message(text: "hello", user_id: "U123", user_name: "testuser", channel_id: "C123", thread_id: "T123")
  author = Author.new(id: user_id, name: user_name, platform: :test)
  Message.new(
    id: "msg_#{rand(10000..99999)}",
    text: text,
    author: author,
    thread_id: thread_id,
    channel_id: channel_id,
    platform: :test
  )
end

#fake_adapterObject



10
11
12
# File 'lib/chat_sdk/testing/helpers.rb', line 10

def fake_adapter
  @fake_adapter ||= FakeAdapter.new
end