зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-08-28 15:26:18 +03:00
@@ -3,7 +3,7 @@ RSpec.describe Telegram::Bot::Client::TypedResponse do
|
||||
|
||||
describe '#get_me' do
|
||||
subject { bot.get_me }
|
||||
before { expect(bot).to receive(:request).with(:getMe) { response } }
|
||||
before { expect(bot).to receive(:request).with('getMe') { response } }
|
||||
let(:response) { {'ok' => true, 'result' => {'id' => user_id}} }
|
||||
let(:user_id) { 123 }
|
||||
it { should be_instance_of Telegram::Bot::Types::User }
|
||||
@@ -17,7 +17,7 @@ RSpec.describe Telegram::Bot::Client::TypedResponse do
|
||||
|
||||
describe '#get_updates' do
|
||||
subject { bot.get_updates }
|
||||
before { expect(bot).to receive(:request).with(:getUpdates) { response } }
|
||||
before { expect(bot).to receive(:request).with('getUpdates') { response } }
|
||||
let(:response) { {'ok' => true, 'result' => [{'update_id' => update_id}]} }
|
||||
let(:update_id) { 123 }
|
||||
it { should be_instance_of Array }
|
||||
@@ -29,4 +29,16 @@ RSpec.describe Telegram::Bot::Client::TypedResponse do
|
||||
it { expect { subject }.to raise_error Telegram::Bot::Error }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#delete_webhook' do
|
||||
subject { bot.delete_webhook }
|
||||
before { expect(bot).to receive(:request).with('deleteWebhook') { response } }
|
||||
let(:response) { {'ok' => true, 'result' => true} }
|
||||
it { should eq true }
|
||||
|
||||
context 'on error' do
|
||||
let(:response) { raise Telegram::Bot::Error }
|
||||
it { expect { subject }.to raise_error Telegram::Bot::Error }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Ссылка в новой задаче
Block a user