telegram-bot-rb / telegram-bot

Ruby gem for building Telegram Bot with optional Rails integration
MIT License
633 stars 113 forks source link

SimpleCov with ClientStub #194

Closed mario-amazing closed 1 year ago

mario-amazing commented 1 year ago

SimpleCov doesn't see request to TelegramWebhookControlle controllers with ClientStub.

Telegram.reset_bots
Telegram::Bot::ClientStub.stub_all!
image

How to fix this behaviour?

printercu commented 1 year ago

stub_all! doesn't affect coverage. Is coverage collected for other classes in other tests?

mario-amazing commented 1 year ago

You are right, stub_all does not affect this. But the coverage is still 0%. But the coverage is empty only for telegram controllers

image
mario-amazing commented 1 year ago

Found solution, simplecov should be the first line in rails_helper:

require 'simplecov'
SimpleCov.start 'rails'

Telegram.reset_bots
Telegram::Bot::ClientStub.stub_all!