зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-09-06 19:15:50 +03:00
Support for testing bots in poller mode and non-Rails apps
Этот коммит содержится в:
5
spec/telegram/bot/rspec/integration/poller_spec.rb
Обычный файл
5
spec/telegram/bot/rspec/integration/poller_spec.rb
Обычный файл
@@ -0,0 +1,5 @@
|
||||
require 'telegram/bot/rspec/integration/poller'
|
||||
|
||||
RSpec.describe 'Poller integration spec', telegram_bot: :poller do
|
||||
include_examples 'shared integration examples'
|
||||
end
|
||||
20
spec/telegram/bot/rspec/integration/rack_spec.rb
Обычный файл
20
spec/telegram/bot/rspec/integration/rack_spec.rb
Обычный файл
@@ -0,0 +1,20 @@
|
||||
require 'telegram/bot/rspec/integration/rack'
|
||||
|
||||
RSpec.describe 'Rack integration spec', telegram_bot: :rack do
|
||||
include_examples 'shared integration examples'
|
||||
let(:request_path) { '/bot' }
|
||||
let(:app) do
|
||||
path = request_path
|
||||
bot_app = Telegram::Bot::Middleware.new(bot, controller_class)
|
||||
app = Rack::Builder.new do
|
||||
map(path) { run bot_app }
|
||||
run ->(env) { raise "Route is not mapped: #{env['PATH_INFO']}" }
|
||||
end
|
||||
if ActionPack::VERSION::MAJOR >= 5
|
||||
app
|
||||
else
|
||||
require 'action_dispatch/middleware/params_parser'
|
||||
ActionDispatch::ParamsParser.new(app)
|
||||
end
|
||||
end
|
||||
end
|
||||
1
spec/telegram/bot/rspec/integration/rails_spec.rb
Обычный файл
1
spec/telegram/bot/rspec/integration/rails_spec.rb
Обычный файл
@@ -0,0 +1 @@
|
||||
# Tested in spec/integration
|
||||
Ссылка в новой задаче
Block a user