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

Testing: run multiple dispatches on same instance

Этот коммит содержится в:
Max Melentiev
2016-03-04 20:08:25 +06:00
родитель 32b6794924
Коммит e767a65faa
8 изменённых файлов: 100 добавлений и 31 удалений

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

@@ -0,0 +1,27 @@
RSpec.describe Telegram::Bot::UpdatesController::Testing do
include_context 'telegram/bot/updates_controller'
let(:controller_class) do
Class.new(Telegram::Bot::UpdatesController) do
attr_accessor :ivar
end
end
describe '#recycle!' do
subject { -> { controller.recycle!(full) } }
before do
controller.ivar = :ival
session[:key] = 'sval'
end
let(:full) {}
it { should_not change(controller, :ivar).from :ival }
it { should_not change { controller.send(:session)[:key] }.from 'sval' }
context 'when full is true' do
let(:full) { true }
it { should change(controller, :ivar).from(:ival).to nil }
it { should change { controller.instance_variable_defined?(:@ivar) }.to false }
it { should_not change { controller.send(:session)[:key] }.from 'sval' }
end
end
end

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

@@ -8,7 +8,7 @@ RSpec.describe Telegram::Bot::UpdatesController::TypedUpdate do
end
context 'when `update` is a virtus model' do
subject { instance }
subject { controller }
%w(
message
inline_query