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