1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-03 09:46:17 +03:00

Support for testing bots in poller mode and non-Rails apps

Этот коммит содержится в:
Max Melentiev
2018-05-25 18:48:38 +03:00
родитель 050df20533
Коммит 4d76941d03
18 изменённых файлов: 331 добавлений и 170 удалений

24
spec/support/examples/integration.rb Обычный файл
Просмотреть файл

@@ -0,0 +1,24 @@
RSpec.shared_examples 'shared integration examples' do
let(:bot) { Telegram::Bot::ClientStub.new('token') }
let(:controller_class) do
Class.new(Telegram::Bot::UpdatesController) do
def start(data = nil, *)
respond_with :message, text: "Hi #{data}"
end
def callback_query(data, *)
answer_callback_query "pong: #{data}"
end
end
end
describe '#start' do
subject { -> { dispatch_command(:start, :test_data) } }
it { should respond_with_message('Hi test_data') }
end
describe '#callback_query', :callback_query do
let(:data) { :test_data }
it { should answer_callback_query "pong: #{data}" }
end
end