Sha256: d05f9d6bb496b12946250f30598d8ff2c50c37a1864da454f81746c214d2cbac

Contents?: true

Size: 745 Bytes

Versions: 3

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

require 'telegram/bot/rspec/integration/shared'
require 'rack/test'

RSpec.shared_context 'telegram/bot/integration/rack' do
  include_context 'telegram/bot/integration/shared'
  include Rack::Test::Methods

  let(:request_path) { raise '`let(:request_path) { path to bot }` is required' }
  let(:app) { raise '`let(:app) { your rack app here }` is required' }
  let(:request_headers) do
    {
      'ACCEPT' => 'application/json',
      'CONTENT_TYPE' => 'application/json',
    }
  end

  def dispatch(update)
    post request_path, update.to_json, request_headers
  end
end

Telegram::Bot::RSpec.with_include_context do |config|
  config.include_context 'telegram/bot/integration/rack', telegram_bot: :rack
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
telegram-bot-0.16.5 lib/telegram/bot/rspec/integration/rack.rb
telegram-bot-0.16.4 lib/telegram/bot/rspec/integration/rack.rb
telegram-bot-0.16.3 lib/telegram/bot/rspec/integration/rack.rb