зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-08-28 15:26:18 +03:00
* Update rubopcop [WIP] * Further rubocop fixes * Fix rubocop-rails cops * Fix spec * Disable rubocop suggestions * Run rubocop in github actions rather than in codeclimate
31 строка
984 B
Ruby
31 строка
984 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Telegram::Bot::Async::Job do
|
|
let(:job_class) do
|
|
described_class = self.described_class
|
|
client_class = self.client_class
|
|
Class.new do
|
|
include described_class
|
|
self.client_class = client_class
|
|
end
|
|
end
|
|
let(:client_class) { Telegram::Bot::Client }
|
|
let(:instance) { job_class.new }
|
|
|
|
describe '#perform' do
|
|
subject { instance.perform(id, *args) }
|
|
let(:id) { 'bot_id' }
|
|
let(:args) { [double(:action), {body: :content}] }
|
|
let(:client) { Telegram::Bot::Client.new(async: custom_job_class) }
|
|
let(:custom_job_class) { Class.new }
|
|
let(:result) { double(status: 200, body: '{"test":"ok"}') }
|
|
|
|
it 'finds client and performs request' do
|
|
expect(client_class).to receive(:wrap).with(id.to_sym) { client }
|
|
expect(client).to receive(:request).with(*args).and_call_original
|
|
expect(client).to receive(:http_request) { result }
|
|
should eq 'test' => 'ok'
|
|
end
|
|
end
|
|
end
|