зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-09-08 11:55:51 +03:00
Update rubocop
Этот коммит содержится в:
@@ -1,3 +1,6 @@
|
|||||||
|
# Rubocop does not support 2.0
|
||||||
|
Gemspec/RequiredRubyVersion: {Enabled: false}
|
||||||
|
|
||||||
Rails: {Enabled: true}
|
Rails: {Enabled: true}
|
||||||
|
|
||||||
Layout/AlignParameters:
|
Layout/AlignParameters:
|
||||||
|
|||||||
2
Gemfile
2
Gemfile
@@ -14,7 +14,7 @@ group :development do
|
|||||||
gem 'rspec-its', '~> 1.1.0'
|
gem 'rspec-its', '~> 1.1.0'
|
||||||
gem 'rspec-rails', '~> 3.5.0'
|
gem 'rspec-rails', '~> 3.5.0'
|
||||||
|
|
||||||
gem 'rubocop', '~> 0.51.0'
|
gem 'rubocop', '~> 0.52.1'
|
||||||
|
|
||||||
gem 'coveralls', '~> 0.8.2', require: false
|
gem 'coveralls', '~> 0.8.2', require: false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ require 'httpclient'
|
|||||||
module Telegram
|
module Telegram
|
||||||
module Bot
|
module Bot
|
||||||
class Client
|
class Client
|
||||||
URL_TEMPLATE = 'https://api.telegram.org/bot%s/'.freeze
|
URL_TEMPLATE = 'https://api.telegram.org/bot%<token>s/'.freeze
|
||||||
|
|
||||||
autoload :TypedResponse, 'telegram/bot/client/typed_response'
|
autoload :TypedResponse, 'telegram/bot/client/typed_response'
|
||||||
extend Initializers
|
extend Initializers
|
||||||
@@ -44,7 +44,7 @@ module Telegram
|
|||||||
@client = HTTPClient.new
|
@client = HTTPClient.new
|
||||||
@token = token || options[:token]
|
@token = token || options[:token]
|
||||||
@username = username || options[:username]
|
@username = username || options[:username]
|
||||||
@base_uri = format URL_TEMPLATE, self.token
|
@base_uri = format(URL_TEMPLATE, token: self.token)
|
||||||
end
|
end
|
||||||
|
|
||||||
def request(action, body = {})
|
def request(action, body = {})
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ RSpec.describe Telegram::Bot::Client do
|
|||||||
describe '#request' do
|
describe '#request' do
|
||||||
subject { -> { instance.request(action, request_body) } }
|
subject { -> { instance.request(action, request_body) } }
|
||||||
let(:action) { :some_action }
|
let(:action) { :some_action }
|
||||||
let(:url) { "#{format described_class::URL_TEMPLATE, token}#{action}" }
|
let(:url) { "#{format(described_class::URL_TEMPLATE, token: token)}#{action}" }
|
||||||
let(:request_body) { double(:body) }
|
let(:request_body) { double(:body) }
|
||||||
let(:prepared_body) { double(:prepared_body) }
|
let(:prepared_body) { double(:prepared_body) }
|
||||||
let(:response) { HTTP::Message.new_response(body).tap { |x| x.status = status } }
|
let(:response) { HTTP::Message.new_response(body).tap { |x| x.status = status } }
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user