зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-09-03 09:46:17 +03:00
fixed controller's callbacks for rails5
Этот коммит содержится в:
@@ -63,7 +63,7 @@ module Telegram
|
||||
|
||||
include AbstractController::Callbacks
|
||||
# Redefine callbacks with default terminator.
|
||||
if ActiveSupport.gem_version >= Gem::Version.new('5')
|
||||
if ActiveSupport::VERSION::MAJOR >= 5
|
||||
define_callbacks :process_action,
|
||||
skip_after_callbacks_if_terminated: true
|
||||
else
|
||||
|
||||
@@ -225,12 +225,12 @@ RSpec.describe Telegram::Bot::UpdatesController do
|
||||
it { should change(controller, :acted).to true }
|
||||
its(:call) { should eq [nil, nil, args] }
|
||||
|
||||
context 'when callback returns false' do
|
||||
context 'when callback halts chain' do
|
||||
before do
|
||||
controller_class.prepend(Module.new do
|
||||
def hook
|
||||
super
|
||||
false
|
||||
ActiveSupport::VERSION::MAJOR >= 5 ? throw(:abort) : false
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
Ссылка в новой задаче
Block a user