зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-08-28 15:26:18 +03:00
Fix frozen string issue for ruby < 3 (#235)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ad1eb5a47f
Коммит
ffd17ec933
@@ -117,15 +117,15 @@ module Telegram
|
||||
:arg_list_matcher, :matching_requests_count
|
||||
|
||||
def base_message
|
||||
"make #{expectation_type.to_s.tr('_', ' ')} #{expected_number} " \
|
||||
"#{bot.inspect}.#{action} requests,".tap do |msg|
|
||||
msg << " with #{arg_list_matcher}," if arg_list_matcher
|
||||
msg << " but made #{matching_requests_count}"
|
||||
if performed_requests
|
||||
actual_args = performed_requests.map(&:inspect).join(', ')
|
||||
msg << ", and #{performed_requests.count} with #{actual_args}"
|
||||
end
|
||||
msg = "make #{expectation_type.to_s.tr('_', ' ')} #{expected_number} " \
|
||||
"#{bot.inspect}.#{action} requests,"
|
||||
msg += " with #{arg_list_matcher}," if arg_list_matcher
|
||||
msg += " but made #{matching_requests_count}"
|
||||
if performed_requests
|
||||
actual_args = performed_requests.map(&:inspect).join(', ')
|
||||
msg += ", and #{performed_requests.count} with #{actual_args}"
|
||||
end
|
||||
msg
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ module Telegram
|
||||
payload = event.payload
|
||||
additions = UpdatesController.log_process_action(payload)
|
||||
message = "Completed in #{event.duration.round}ms"
|
||||
message << " (#{additions.join(' | ')})" if additions.present?
|
||||
message += " (#{additions.join(' | ')})" if additions.present?
|
||||
message
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,6 +33,9 @@ RSpec.describe Telegram::Bot::RSpec::ClientMatchers do
|
||||
args = {text: 'test', parseMode: :Markdown}
|
||||
block = ->(*) { bot.send_message(args) }
|
||||
expect(&block).to make_telegram_request(bot, :sendMessage).with(args)
|
||||
expect do
|
||||
expect(&block).to make_telegram_request(bot, :sendMessage).with(args.merge(extra: 1))
|
||||
end.to raise_error RSpec::Expectations::ExpectationNotMetError
|
||||
expect(&block).to_not make_telegram_request(bot, :sendMessage).with(args.except(:text))
|
||||
expect { 3.times(&block) }.to make_telegram_request(bot, :sendMessage).
|
||||
with(args).exactly(3).times
|
||||
|
||||
Ссылка в новой задаче
Block a user