lib/telegram/bot/client_stub.rb in telegram-bot-0.16.1 vs lib/telegram/bot/client_stub.rb in telegram-bot-0.16.3

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Telegram module Bot # Stubbed client for tests. Saves all requests into #requests hash. class ClientStub < Client attr_reader :requests @@ -15,11 +17,11 @@ end class << self # Any call to Client.new will return ClientStub instance when `enabled` is true. # Can be used with a block. - def stub_all!(enabled = true) + def stub_all!(enabled = true) # rubocop:disable Style/OptionalBooleanParameter Client.extend(StubbedConstructor) unless Client < StubbedConstructor return @_stub_all = enabled unless block_given? begin old = @_stub_all stub_all!(enabled) @@ -32,10 +34,10 @@ def stub_all? @_stub_all end end - def initialize(token = nil, username = nil, **options) + def initialize(token = nil, username = nil, **options) # rubocop:disable Lint/MissingSuper @token = token || options[:token] @username = username || options[:username] || token reset end