Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat callback_query_id as string in spec helper #231

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

rndev15
Copy link
Contributor

@rndev15 rndev15 commented Apr 15, 2024

Hey there,
I found this issue when I have TypedUpdate and callback_query.

In specs:

context 'callback query', :callback_query do
  let(:data) { 1 }

  it { should answer_callback_query 'response', show_alert: true }
end
I had the following error:

Failure/Error: it { should answer_callback_query 'response', show_alert: true }
       expected to make exactly 1 #<Telegram::Bot::ClientStub#...>.answerCallbackQuery requests, with [#<RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher:... @expected={:show_alert=>true, :callback_query_id=>11, :text=>"response"}>], but made 0, and 1 with {:show_alert=>true, :callback_query_id=>"11", :text=>"response"}

spec helpers expecting callback_query_id as Integer, while app returns string.

This PR fixes it, but I can make additional changes (if needed)

Previously I made a PR to telegram-bot-types telegram-bot-rb/telegram-bot-types#7, but maintainer told me that while API expects String, we have to fix spec helpers, not types.

@printercu printercu merged commit b05f17b into telegram-bot-rb:master Apr 16, 2024
9 checks passed
@printercu
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants