module TelegramActionExampleGroup

Public Class Methods

included(klass) click to toggle source
# File lib/telegram_workflow/rspec.rb, line 2
def self.included(klass)
  klass.class_eval do
    klass.metadata[:type] = :telegram_action

    subject { double(client: spy, flow: spy) }

    let(:current_action) { described_class }
    let(:action_params) do
      {
        "update_id" => 111111111,
        "message" => {
          "message_id" => 200,
          "from" => {
            "id" => 112233445,
          },
          "text" => ""
        },
        "callback_query" => {
          "data" => ""
        },
        "inline_query" => {
          "query" => ""
        }
      }
    end

    before do
      TelegramWorkflow.config.session_store = TelegramWorkflow::Stores::InMemory.new
      TelegramWorkflow.config.start_action = TestStartAction
      send_message message_text: "/start"
    end

    include InstanceMethods
  end
end