From 9af6de8d365d5d53ec0525e510376176642bd72e Mon Sep 17 00:00:00 2001 From: Max Melentiev Date: Wed, 21 Feb 2018 19:49:09 +0300 Subject: [PATCH 1/2] Avoid Hash#transform_values. Fixes #63 --- lib/telegram/bot/config_methods.rb | 3 +-- lib/telegram/bot/updates_controller/rspec_helpers.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/telegram/bot/config_methods.rb b/lib/telegram/bot/config_methods.rb index 611de4f..3e31688 100644 --- a/lib/telegram/bot/config_methods.rb +++ b/lib/telegram/bot/config_methods.rb @@ -1,5 +1,4 @@ require 'active_support/core_ext/hash/keys' -require 'active_support/core_ext/hash/transform_values' require 'active_support/core_ext/hash/indifferent_access' module Telegram @@ -43,7 +42,7 @@ module Telegram # Hash of botan clients made from #bots. def botans - @botans ||= bots.transform_values(&:botan) + @botans ||= bots.map { |k, v| [k, v.botan] }.to_h end # Returns config for .bots method. By default uses `telegram['bots']` section diff --git a/lib/telegram/bot/updates_controller/rspec_helpers.rb b/lib/telegram/bot/updates_controller/rspec_helpers.rb index 1a4981a..1145a61 100644 --- a/lib/telegram/bot/updates_controller/rspec_helpers.rb +++ b/lib/telegram/bot/updates_controller/rspec_helpers.rb @@ -35,7 +35,7 @@ RSpec.shared_context 'telegram/bot/updates_controller' do def deep_stringify(input) case input when Array then input.map(&method(__callee__)) - when Hash then input.transform_keys(&:to_s).transform_values(&method(__callee__)) + when Hash then input.map { |k, v| [k.to_s, deep_stringify(v)] }.to_h else input end end From f39a4511925f2fc2249f2431c2b9976a2cd2a9e2 Mon Sep 17 00:00:00 2001 From: Max Melentiev Date: Wed, 21 Feb 2018 20:32:19 +0300 Subject: [PATCH 2/2] Add rails-6 to build matrix --- .travis.yml | 28 +++++++++++++++++++++------- Appraisals | 7 +++++++ gemfiles/rails_60.gemfile | 23 +++++++++++++++++++++++ 3 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 gemfiles/rails_60.gemfile diff --git a/.travis.yml b/.travis.yml index 6d466bc..2e1d68e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,28 @@ language: ruby cache: bundler rvm: - - 2.5 - - 2.4 - - 2.3 +- 2.5 +- 2.4 gemfile: - - gemfiles/rails_52.gemfile - - gemfiles/rails_51.gemfile - - gemfiles/rails_50.gemfile - - gemfiles/rails_42.gemfile +- gemfiles/rails_52.gemfile +- gemfiles/rails_51.gemfile +matrix: + include: + # old rails + - rvm: 2.5 + gemfile: gemfiles/rails_50.gemfile + - rvm: 2.5 + gemfile: gemfiles/rails_42.gemfile + # old rubies + - rvm: 2.3 + gemfile: gemfiles/rails_52.gemfile + # future rails + - rvm: 2.5 + gemfile: gemfiles/rails_60.gemfile + # Allow rails 6 to fail while master branch is used + allow_failures: + - rvm: 2.5 + gemfile: gemfiles/rails_60.gemfile notifications: email: false diff --git a/Appraisals b/Appraisals index 6b2670d..2505839 100644 --- a/Appraisals +++ b/Appraisals @@ -1,3 +1,10 @@ +appraise 'rails-60' do + git 'https://github.com/rails/rails.git' do + gem 'actionpack', '~> 6.0.0.alpha' + gem 'railties', '~> 6.0.0.alpha' + end +end + appraise 'rails-52' do gem 'actionpack', '~> 5.2.0.beta2' gem 'railties', '~> 5.2.0.beta2' diff --git a/gemfiles/rails_60.gemfile b/gemfiles/rails_60.gemfile new file mode 100644 index 0000000..5501673 --- /dev/null +++ b/gemfiles/rails_60.gemfile @@ -0,0 +1,23 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +git "https://github.com/rails/rails.git" do + gem "actionpack", "~> 6.0.0.alpha" + gem "railties", "~> 6.0.0.alpha" +end + +group :development do + gem "appraisal", "~> 2.2" + gem "pry", "~> 0.10.1" + gem "pry-byebug", "~> 3.2.0" + gem "sdoc", "~> 0.4.1" + gem "telegram-bot-types", "~> 0.3.0" + gem "rspec", "~> 3.5.0" + gem "rspec-its", "~> 1.1.0" + gem "rspec-rails", "~> 3.5.0" + gem "rubocop", "~> 0.52.1" + gem "coveralls", "~> 0.8.2", require: false +end + +gemspec path: "../"