diff --git a/.circleci/config.yml b/.circleci/config.yml index 3316d86..8020150 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,7 @@ orbs: defaults: &defaults docker: - - image: circleci/ruby:2.6.5-browsers + - image: circleci/ruby:2.7.0-browsers - image: circleci/postgres:11.5 environment: POSTGRES_USER: moss_back_test diff --git a/.rubocop.yml b/.rubocop.yml index 81e1c1f..97a6a0d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,12 +7,12 @@ AllCops: - "tmp/**/*" - "db/schema.rb" -Metrics/LineLength: +Layout/LineLength: Max: 120 +# TODO: Enable this Metrics/BlockLength: - Exclude: - - "**/*_spec.rb" + Enabled: false Style/Documentation: Enabled: false @@ -31,3 +31,15 @@ RSpec/ExampleLength: RSpec/NestedGroups: Max: 4 + +# New rules to opt-in after v0.80 +# Cf: https://docs.rubocop.org/en/latest/versioning/ + +Style/HashEachMethods: + Enabled: true + +Style/HashTransformKeys: + Enabled: true + +Style/HashTransformValues: + Enabled: true \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index a7b1491..68e042f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.6.5 \ No newline at end of file +ruby-2.7.0 \ No newline at end of file diff --git a/Gemfile b/Gemfile index 66fa7dc..1d3cad4 100644 --- a/Gemfile +++ b/Gemfile @@ -3,14 +3,14 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.6.5' +ruby '2.7.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.2.3' +gem 'rails', '~> 6.0.2', '>= 6.0.2.1' # Use postgresql as the database for Active Record gem 'pg' # Use Puma as the app server -gem 'puma', '~> 3.12' +gem 'puma', '~> 4.1' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'mini_racer', platforms: :ruby @@ -22,7 +22,7 @@ gem 'jbuilder', '~> 2.5' # gem 'redis', '~> 4.0' # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.1.0', require: false +gem 'bootsnap', '>= 1.4.2', require: false gem 'rack-cors' @@ -42,11 +42,9 @@ group :development, :test do end group :development do + gem 'listen', '>= 3.0.5', '< 3.2' gem 'rubocop', require: false gem 'rubocop-rspec', require: false - # Access an interactive console on exception pages or by calling 'console' anywhere in the code. - gem 'listen', '>= 3.0.5', '< 3.2' - gem 'web-console', '>= 3.3.0' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' @@ -54,11 +52,6 @@ end group :test do gem 'shoulda-matchers' - # Adds support for Capybara system testing and selenium driver - gem 'capybara', '>= 2.15' - gem 'selenium-webdriver' - # Easy installation and use of chromedriver to run system tests with Chrome - gem 'chromedriver-helper' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/Gemfile.lock b/Gemfile.lock index c6fddbb..a57b12f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,72 +1,72 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.2.4) - actionpack (= 5.2.4) + actioncable (6.0.2.1) + actionpack (= 6.0.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4) - actionpack (= 5.2.4) - actionview (= 5.2.4) - activejob (= 5.2.4) + actionmailbox (6.0.2.1) + actionpack (= 6.0.2.1) + activejob (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) + mail (>= 2.7.1) + actionmailer (6.0.2.1) + actionpack (= 6.0.2.1) + actionview (= 6.0.2.1) + activejob (= 6.0.2.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4) - actionview (= 5.2.4) - activesupport (= 5.2.4) - rack (~> 2.0) + actionpack (6.0.2.1) + actionview (= 6.0.2.1) + activesupport (= 6.0.2.1) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4) - activesupport (= 5.2.4) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.2.1) + actionpack (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) + nokogiri (>= 1.8.5) + actionview (6.0.2.1) + activesupport (= 6.0.2.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.4) - activesupport (= 5.2.4) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.2.1) + activesupport (= 6.0.2.1) globalid (>= 0.3.6) - activemodel (5.2.4) - activesupport (= 5.2.4) - activerecord (5.2.4) - activemodel (= 5.2.4) - activesupport (= 5.2.4) - arel (>= 9.0) - activestorage (5.2.4) - actionpack (= 5.2.4) - activerecord (= 5.2.4) + activemodel (6.0.2.1) + activesupport (= 6.0.2.1) + activerecord (6.0.2.1) + activemodel (= 6.0.2.1) + activesupport (= 6.0.2.1) + activestorage (6.0.2.1) + actionpack (= 6.0.2.1) + activejob (= 6.0.2.1) + activerecord (= 6.0.2.1) marcel (~> 0.3.1) - activesupport (5.2.4) + activesupport (6.0.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - archive-zip (0.12.0) - io-like (~> 0.3.0) - arel (9.0.0) ast (2.4.0) - bindex (0.8.1) - bootsnap (1.4.5) + bootsnap (1.4.6) msgpack (~> 1.0) - builder (3.2.3) - byebug (11.0.1) - capybara (3.29.0) - addressable - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (~> 1.5) - xpath (~> 3.2) - childprocess (3.0.0) - chromedriver-helper (2.1.1) - archive-zip (~> 0.10) - nokogiri (~> 1.8) - concurrent-ruby (1.1.5) - crass (1.0.5) + bootsnap (1.4.6-java) + msgpack (~> 1.0) + builder (3.2.4) + byebug (11.1.1) + concurrent-ruby (1.1.6) + crass (1.0.6) css_parser (1.7.1) addressable diff-lcs (1.3) @@ -80,21 +80,24 @@ GEM factory_bot_rails (5.1.1) factory_bot (~> 5.1.0) railties (>= 4.2.0) - faker (2.7.0) - i18n (>= 1.6, < 1.8) - faraday (0.17.1) + faker (2.10.2) + i18n (>= 1.6, < 2) + faraday (1.0.0) multipart-post (>= 1.2, < 3) - ffi (1.11.3) + ffi (1.12.2) + ffi (1.12.2-java) + ffi (1.12.2-x64-mingw32) + ffi (1.12.2-x86-mingw32) globalid (0.4.2) activesupport (>= 4.2.0) - hashie (3.6.0) + hashie (4.1.0) htmlentities (4.3.4) - i18n (1.7.0) + i18n (1.8.2) concurrent-ruby (~> 1.0) - io-like (0.3.0) jaro_winkler (1.5.4) - jbuilder (2.9.1) - activesupport (>= 4.2.0) + jaro_winkler (1.5.4-java) + jbuilder (2.10.0) + activesupport (>= 5.0.0) jwt (2.2.1) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) @@ -108,25 +111,34 @@ GEM marcel (0.3.3) mimemagic (~> 0.3.2) method_source (0.9.2) - mimemagic (0.3.3) + mimemagic (0.3.4) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.13.0) - msgpack (1.3.1) + minitest (5.14.0) + msgpack (1.3.3) + msgpack (1.3.3-java) + msgpack (1.3.3-x64-mingw32) + msgpack (1.3.3-x86-mingw32) multi_json (1.14.1) multi_xml (0.6.0) multipart-post (2.1.1) nio4r (2.5.2) - nokogiri (1.10.8) + nio4r (2.5.2-java) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + nokogiri (1.10.9-java) + nokogiri (1.10.9-x64-mingw32) mini_portile2 (~> 2.4.0) - oauth2 (1.4.2) + nokogiri (1.10.9-x86-mingw32) + mini_portile2 (~> 2.4.0) + oauth2 (1.4.4) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - omniauth (1.9.0) - hashie (>= 3.4.6, < 3.7.0) + omniauth (1.9.1) + hashie (>= 3.4.6) rack (>= 1.6.2, < 3) omniauth-google-oauth2 (0.8.0) jwt (>= 2.0) @@ -136,62 +148,69 @@ GEM oauth2 (~> 1.1) omniauth (~> 1.9) parallel (1.19.1) - parser (2.6.5.0) + parser (2.7.0.4) ast (~> 2.4.0) - pg (1.1.4) + pg (1.2.2) + pg (1.2.2-x64-mingw32) + pg (1.2.2-x86-mingw32) premailer (1.11.1) addressable css_parser (>= 1.6.0) htmlentities (>= 4.0.0) - premailer-rails (1.10.3) + premailer-rails (1.11.0) actionmailer (>= 3) premailer (~> 1.7, >= 1.7.9) - public_suffix (4.0.1) - puma (3.12.4) - rack (2.0.8) - rack-cors (1.1.0) + public_suffix (4.0.3) + puma (4.3.3) + nio4r (~> 2.0) + puma (4.3.3-java) + nio4r (~> 2.0) + rack (2.2.2) + rack-cors (1.1.1) rack (>= 2.0.0) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4) - actioncable (= 5.2.4) - actionmailer (= 5.2.4) - actionpack (= 5.2.4) - actionview (= 5.2.4) - activejob (= 5.2.4) - activemodel (= 5.2.4) - activerecord (= 5.2.4) - activestorage (= 5.2.4) - activesupport (= 5.2.4) + rails (6.0.2.1) + actioncable (= 6.0.2.1) + actionmailbox (= 6.0.2.1) + actionmailer (= 6.0.2.1) + actionpack (= 6.0.2.1) + actiontext (= 6.0.2.1) + actionview (= 6.0.2.1) + activejob (= 6.0.2.1) + activemodel (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) bundler (>= 1.3.0) - railties (= 5.2.4) + railties (= 6.0.2.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (5.2.4) - actionpack (= 5.2.4) - activesupport (= 5.2.4) + railties (6.0.2.1) + actionpack (= 6.0.2.1) + activesupport (= 6.0.2.1) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.0.0) rake (13.0.1) rb-fsevent (0.10.3) - rb-inotify (0.10.0) + rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (1.6.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) - rspec-expectations (3.9.0) + rexml (3.2.4) + rspec-core (3.9.1) + rspec-support (~> 3.9.1) + rspec-expectations (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-mocks (3.9.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-rails (3.9.0) + rspec-rails (3.9.1) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -199,25 +218,22 @@ GEM rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) - rspec-support (3.9.0) + rspec-support (3.9.2) rspec_junit_formatter (0.4.1) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (0.77.0) + rubocop (0.80.1) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) + rexml ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) - rubocop-rspec (1.37.0) + rubocop-rspec (1.38.1) rubocop (>= 0.68.1) ruby-progressbar (1.10.1) ruby_dep (1.5.0) - rubyzip (2.0.0) - selenium-webdriver (3.142.6) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) - shoulda-matchers (4.1.2) + shoulda-matchers (4.3.0) activesupport (>= 4.2.0) spring (2.1.0) spring-watcher-listen (2.0.1) @@ -230,30 +246,31 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) - tzinfo (1.2.5) + thread_safe (0.3.6-java) + tzinfo (1.2.6) thread_safe (~> 0.1) - unicode-display_width (1.6.0) - web-console (3.7.0) - actionview (>= 5.0) - activemodel (>= 5.0) - bindex (>= 0.4.0) - railties (>= 5.0) + tzinfo-data (1.2019.3) + tzinfo (>= 1.0.0) + unicode-display_width (1.6.1) websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) + websocket-driver (0.7.1-java) + websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) - xpath (3.2.0) - nokogiri (~> 1.8) + zeitwerk (2.3.0) PLATFORMS + java ruby + x64-mingw32 + x86-mingw32 + x86-mswin32 DEPENDENCIES - bootsnap (>= 1.1.0) + bootsnap (>= 1.4.2) byebug - capybara (>= 2.15) - chromedriver-helper dotenv-rails factory_bot_rails faker @@ -263,22 +280,20 @@ DEPENDENCIES omniauth-google-oauth2 pg premailer-rails - puma (~> 3.12) + puma (~> 4.1) rack-cors - rails (~> 5.2.3) + rails (~> 6.0.2, >= 6.0.2.1) rspec-rails rspec_junit_formatter rubocop rubocop-rspec - selenium-webdriver shoulda-matchers spring spring-watcher-listen (~> 2.0.0) tzinfo-data - web-console (>= 3.3.0) RUBY VERSION - ruby 2.6.5p114 + ruby 2.7.0p0 BUNDLED WITH 1.17.3 diff --git a/README.md b/README.md index c2284cb..67f2ce6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Installing - [Install rvm](https://rvm.io/rvm/install) -- Install ruby-2.6.5 : `rvm install "ruby-2.6.5"` +- Install ruby-2.7.0 : `rvm install "ruby-2.6.5"` - Install bundler : `gem install bundler` - Install postgres : - `brew install postgres` @@ -21,6 +21,10 @@ `rspec` +Or : + +`RUBYOPT='-W0' rspec` if there are Ruby 2.7 warnings + ## Start server `rails s` diff --git a/config/application.rb b/config/application.rb index ac93749..2f057f6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,7 +11,7 @@ module MossBack class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.2 + config.load_defaults '6.0' config.middleware.insert_before 0, Rack::Cors do allow do diff --git a/config/environments/production.rb b/config/environments/production.rb index 564deb4..780c1c2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -49,7 +49,7 @@ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 01f7c97..e8240e2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -93,4 +93,9 @@ # # test failures related to randomization by passing the same `--seed` value # # as the one that triggered the failure. # Kernel.srand config.seed + + # Fix to allow tests on ActionMailer::Base.deliveries + config.before(:suite) do + (ActiveJob::Base.descendants << ActiveJob::Base).each(&:disable_test_adapter) + end end