Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- '2.7'
gemfile:
- gemfiles/rails_61.gemfile
- gemfiles/rails_60.gemfile
- gemfiles/rails_52.gemfile
- gemfiles/rails_51.gemfile
include:
# ruby 3.x
- ruby: '3.2'
Expand All @@ -34,10 +27,9 @@ jobs:
gemfile: gemfiles/rails_72.gemfile
- ruby: '3.2'
gemfile: gemfiles/rails_71.gemfile
- ruby: '3.0'
gemfile: gemfiles/rails_61.gemfile
- ruby: '3.0'
gemfile: gemfiles/rails_60.gemfile
# ruby 2.x
- ruby: '2.7'
gemfile: gemfiles/rails_71.gemfile
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require: rubocop-rails

AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.7
NewCops: enable
SuggestExtensions: false
Exclude:
Expand Down
20 changes: 0 additions & 20 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,3 @@ appraise 'rails-70' do
gem 'actionpack', '~> 7.0.0'
gem 'railties', '~> 7.0.0'
end

appraise 'rails-61' do
gem 'actionpack', '~> 6.1.0'
gem 'railties', '~> 6.1.0'
end

appraise 'rails-60' do
gem 'actionpack', '~> 6.0.0'
gem 'railties', '~> 6.0.0'
end

appraise 'rails-52' do
gem 'actionpack', '~> 5.2.0'
gem 'railties', '~> 5.2.0'
end

appraise 'rails-51' do
gem 'actionpack', '~> 5.1.0'
gem 'railties', '~> 5.1.0'
end
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased

- Rails 8.1 support
- Drop support for rails < 7.0 and ruby < 2.7

# 0.16.7

Expand Down
21 changes: 0 additions & 21 deletions gemfiles/rails_51.gemfile

This file was deleted.

21 changes: 0 additions & 21 deletions gemfiles/rails_52.gemfile

This file was deleted.

21 changes: 0 additions & 21 deletions gemfiles/rails_60.gemfile

This file was deleted.

21 changes: 0 additions & 21 deletions gemfiles/rails_61.gemfile

This file was deleted.

4 changes: 2 additions & 2 deletions lib/telegram/bot/rspec/client_matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def matches?(proc) # rubocop:disable Metrics/AbcSize
expected_number.public_send(expectation_method, matching_requests_count)
end

def with(*args, &block)
@arg_list_matcher = ArgListMatcher.new(*args, &block)
def with(...)
@arg_list_matcher = ArgListMatcher.new(...)
self
end

Expand Down
10 changes: 4 additions & 6 deletions lib/telegram/bot/updates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,10 @@ def payload_from_update(update)

def payload_from_typed_update(update)
PAYLOAD_TYPES.find do |type|
begin
item = update[type]
return [item, type] if item
rescue Exception # rubocop:disable Lint/RescueException
# dry-rb raises exception if field is not defined in schema
end
item = update[type]
return [item, type] if item
rescue Exception # rubocop:disable Lint/RescueException
# dry-rb raises exception if field is not defined in schema
end
end
end
Expand Down
16 changes: 4 additions & 12 deletions lib/telegram/bot/updates_controller/instrumentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ class UpdatesController
module Instrumentation
extend ActiveSupport::Concern

included do
if respond_to?(:config_accessor, true)
config_accessor :logger
else
include AbstractController::Logger
end
end
include AbstractController::Logger

class << self
def instrument(action, *args, &block)
Expand All @@ -34,11 +28,9 @@ def process_action(*args)
}
Instrumentation.instrument(:start_processing, raw_payload.dup)
Instrumentation.instrument(:process_action, raw_payload) do |payload|
begin
super
ensure
append_info_to_payload(payload)
end
super
ensure
append_info_to_payload(payload)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/telegram/bot/updates_controller/rspec_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def dispatch(update = self.update, bot = self.bot, webhook_request = self.webhoo
def deep_stringify(input)
case input
when Array then input.map(&method(__callee__))
when Hash then input.map { |k, v| [k.to_s, deep_stringify(v)] }.to_h
when Hash then input.to_h { |k, v| [k.to_s, deep_stringify(v)] }
else input
end
end
Expand Down
14 changes: 6 additions & 8 deletions spec/integration_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@ class TestApplication < Rails::Application
config.include RSpec::Rails::RequestExampleGroup, type: :request

config.around type: :request do |ex|
begin
Telegram.reset_bots
Telegram::Bot::ClientStub.stub_all!
ex.run
ensure
Telegram.reset_bots
Telegram::Bot::ClientStub.stub_all!(false)
end
Telegram.reset_bots
Telegram::Bot::ClientStub.stub_all!
ex.run
ensure
Telegram.reset_bots
Telegram::Bot::ClientStub.stub_all!(false)
end

config.before type: :request do
Expand Down
2 changes: 1 addition & 1 deletion spec/telegram/bot/updates_controller/typed_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
purchased_paid_media
pre_checkout_query
]).
map { |x| [x, Telegram::Bot::Types.const_get(x.camelize)] }.to_h.
to_h { |x| [x, Telegram::Bot::Types.const_get(x.camelize)] }.
merge(
'chat_member' => Telegram::Bot::Types::ChatMemberUpdated
)
Expand Down
2 changes: 1 addition & 1 deletion spec/telegram/bot/updates_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
subject { controller.action_for_payload }

def stub_payload(*fields)
fields.map { |x| [x, double(x)] }.to_h
fields.to_h { |x| [x, double(x)] }
end

context 'when payload is inline_query' do
Expand Down
6 changes: 3 additions & 3 deletions telegram-bot.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.4'
spec.required_ruby_version = '>= 2.7'

spec.add_dependency 'actionpack', '>= 4.0', '< 8.2'
spec.add_dependency 'activesupport', '>= 4.0', '< 8.2'
spec.add_dependency 'actionpack', '>= 7.0', '< 8.2'
spec.add_dependency 'activesupport', '>= 7.0', '< 8.2'
spec.add_dependency 'httpclient', '~> 2.7'

spec.add_development_dependency 'bundler', '> 1.16'
Expand Down
Loading