1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-03 17:55:52 +03:00
Этот коммит содержится в:
Max Melentiev
2018-01-05 13:18:48 +03:00
родитель 70a1ed8a8f
Коммит 45e8a7283f
5 изменённых файлов: 60 добавлений и 2 удалений

Просмотреть файл

@@ -0,0 +1,31 @@
RSpec.describe Telegram::Bot::UpdatesController::Rescue do
include_context 'telegram/bot/updates_controller'
describe '#process_action' do
subject { -> { dispatch_message("/#{command} x y z") } }
let(:controller_class) do
Class.new(Telegram::Bot::UpdatesController) do
rescue_from ArgumentError, with: -> { respond_with :message, text: 'Rescued' }
def rescuable(*)
raise ArgumentError, 'rescuable'
end
def not_rescuable(*)
raise 'not_rescuable'
end
end
end
context 'when exception is rescued' do
let(:command) { :rescuable }
it { should respond_with_message 'Rescued' }
end
context 'when exception is not rescued' do
let(:command) { :not_rescuable }
it { should raise_error('not_rescuable') }
end
end
end