From 08fecf32bb7cfd64a87bcb3b70de52a5d3e4d48d Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Tue, 8 Jun 2021 09:49:22 -0700 Subject: [PATCH 1/2] Updating ruby version for Heroku-20 stack --- .github/workflows/test.yml | 2 +- .ruby-version | 2 +- .travis.yml | 2 +- CONTRIBUTING.md | 2 +- Dockerfile | 2 +- Gemfile | 2 +- Gemfile.lock | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 23785be9..e44304d1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ env: jobs: test: runs-on: ubuntu-20.04 - container: library/ruby:2.5.1 + container: library/ruby:2.6.7 services: postgres: image: library/postgres:9.6 diff --git a/.ruby-version b/.ruby-version index 73462a5a..e261122d 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.1 +2.6.7 diff --git a/.travis.yml b/.travis.yml index fc888a79..93812b1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ cache: bundler # - gem install bundler dist: trusty rvm: - - 2.5.1 + - 2.6.7 before_script: - psql -c 'create database travis_ci_test;' -U postgres - ./bin/rake db:setup diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b1f31d4a..4544114c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ The following external dependencies are also required: * `Postgresql 9.6` * `Redis` - * `Ruby 2.5.1` (optionally `rbenv`) + * `Ruby 2.6.7` (optionally `rbenv`) * `bundler` ### macOS diff --git a/Dockerfile b/Dockerfile index 1d10bc0d..09af3e62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.5.1 +FROM ruby:2.6.7 RUN apt-get update && apt-get install -y \ build-essential openssl libssl-dev libpq-dev postgresql-client diff --git a/Gemfile b/Gemfile index c524eca1..bb691f75 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '2.5.1' +ruby '2.6.7' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 4.2.10' diff --git a/Gemfile.lock b/Gemfile.lock index d948f81d..0d321857 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -340,7 +340,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 2.5.1p57 + ruby 2.6.7p197 BUNDLED WITH - 1.16.6 + 1.17.2 From 1e3cd6068d126f4e970d818b0d0df36849c87c0b Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Tue, 8 Jun 2021 13:55:27 -0700 Subject: [PATCH 2/2] Fix testing failures with monkeypatching and rubocop update --- .rubocop.yml | 12 +++----- Gemfile | 2 +- Gemfile.lock | 32 +++++++++++--------- config.ru | 2 +- spec/controllers/sessions_controller_spec.rb | 17 +++++++++++ 5 files changed, 41 insertions(+), 24 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 6eafab28..dd5172ba 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,5 @@ AllCops: + NewCops: enable DisplayCopNames: true ExtraDetails: true Include: @@ -11,7 +12,7 @@ AllCops: - 'script/**/*' - 'vendor/**/*' -Metrics/LineLength: +Layout/LineLength: Enabled: false Metrics/MethodLength: @@ -62,10 +63,10 @@ Metrics/BlockLength: Lint/AmbiguousBlockAssociation: Enabled: false -Layout/IndentArray: +Layout/FirstArrayElementIndentation: Enabled: false -Layout/IndentHeredoc: +Layout/HeredocIndentation: Enabled: false Style/StringLiterals: @@ -86,7 +87,7 @@ Style/NestedParenthesizedCalls: Lint/UnusedBlockArgument: Enabled: false -Lint/HandleExceptions: +Lint/SuppressedException: Enabled: false Style/HashSyntax: @@ -95,9 +96,6 @@ Style/HashSyntax: Style/GuardClause: Enabled: false -Performance/RedundantMerge: - Enabled: false - Style/SymbolArray: Enabled: false diff --git a/Gemfile b/Gemfile index bb691f75..ae304f22 100644 --- a/Gemfile +++ b/Gemfile @@ -48,7 +48,7 @@ group :development, :test do gem 'rspec', '~> 3.7.0' gem 'rspec-rails' gem 'rspec-activemodel-mocks' - gem 'rubocop', '~> 0.58.0' + gem 'rubocop', '~> 1.16.0' gem 'pry', '0.10.3' gem 'pry-rails', '0.3.4' diff --git a/Gemfile.lock b/Gemfile.lock index 0d321857..ba29f9ca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,7 +38,7 @@ GEM addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) arel (6.0.4) - ast (2.4.0) + ast (2.4.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) @@ -96,7 +96,6 @@ GEM i18n (0.9.5) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - jaro_winkler (1.5.4) jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -140,16 +139,15 @@ GEM omniauth-oauth2 (1.6.0) oauth2 (~> 1.1) omniauth (~> 1.9) - parallel (1.18.0) - parser (2.6.5.0) - ast (~> 2.4.0) + parallel (1.20.1) + parser (3.0.1.1) + ast (~> 2.4.1) pg (0.21.0) pg_array_parser (0.0.9) postgres_ext (3.0.1) activerecord (~> 4.0) arel (>= 4.0.1) pg_array_parser (~> 0.0.9) - powerpack (0.1.2) pry (0.10.3) coderay (~> 1.1.0) method_source (~> 0.8.1) @@ -192,9 +190,10 @@ GEM rake (13.0.1) redis (4.1.3) ref (2.0.0) - regexp_parser (1.6.0) + regexp_parser (1.8.2) request_store (1.4.1) rack (>= 1.4) + rexml (3.2.5) rollbar (2.8.3) multi_json rspec (3.7.0) @@ -222,15 +221,18 @@ GEM rspec-mocks (~> 3.7.0) rspec-support (~> 3.7.0) rspec-support (3.7.1) - rubocop (0.58.2) - jaro_winkler (~> 1.5.1) + rubocop (1.16.0) parallel (~> 1.10) - parser (>= 2.5, != 2.5.1.1) - powerpack (~> 0.1) + parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.7.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.10.1) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.7.0) + parser (>= 3.0.1.1) + ruby-progressbar (1.11.0) safe_yaml (1.0.5) sassc (2.2.1) ffi (~> 1.9) @@ -275,7 +277,7 @@ GEM thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (1.6.0) + unicode-display_width (2.0.0) virtus (1.0.5) axiom-types (~> 0.1) coercible (~> 1.0) @@ -327,7 +329,7 @@ DEPENDENCIES rspec (~> 3.7.0) rspec-activemodel-mocks rspec-rails - rubocop (~> 0.58.0) + rubocop (~> 1.16.0) sassc-rails sidekiq spring diff --git a/config.ru b/config.ru index 806d6d61..0ab32e7f 100644 --- a/config.ru +++ b/config.ru @@ -2,6 +2,6 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path('config/environment', __dir__) run Rails.application diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index 3a1b192e..e02bf156 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -1,5 +1,22 @@ require 'rails_helper' +# Solve rake failures post-upgrade to Ruby 2.6.x per https://github.com/rails/rails/issues/34790#issuecomment-450502805more +if RUBY_VERSION>='2.6.0' + if Rails.version < '5' + class ActionController::TestResponse < ActionDispatch::TestResponse + def recycle! + # hack to avoid MonitorMixin double-initialize error: + @mon_mutex_owner_object_id = nil + @mon_mutex = nil + initialize + end + end + else + puts "Monkeypatch for ActionController::TestResponse no longer needed" + end +end + + RSpec.describe SessionsController, type: :controller do fixtures :users, :github_accounts