Module: TelegramActionExampleGroup

Defined in:
lib/telegram_workflow/rspec.rb

Defined Under Namespace

Modules: InstanceMethods Classes: TestFlow, TestStartAction

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/telegram_workflow/rspec.rb', line 2

def self.included(klass)
  klass.class_eval do
    klass.[: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