diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad9a70f..1bbeb9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ jobs: test: runs-on: ubuntu-latest container: - image: ruby:2.7.1 + image: ruby:3.0.1 services: postgres: image: postgres:12 diff --git a/.rubocop.yml b/.rubocop.yml index 2a74c42..491bf40 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,6 +3,7 @@ inherit_from: ".rubocop_todo.yml" require: - rubocop-minitest - rubocop-performance + - rubocop-rake - rubocop-sequel AllCops: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0acfe9e..219851a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,7 +1,7 @@ Metrics/AbcSize: - Max: 21.79 + Max: 25.04 Metrics/BlockLength: - ExcludedMethods: ['describe', 'route'] + IgnoredMethods: ['describe', 'route'] Metrics/MethodLength: Max: 13 Minitest: diff --git a/.ruby-version b/.ruby-version index 860487c..cb2b00e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.1 +3.0.1 diff --git a/Dockerfile b/Dockerfile index 179ebdd..1bbc3d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.7.1 +FROM ruby:3.0.1 RUN mkdir /app WORKDIR /app diff --git a/Gemfile b/Gemfile index 3225567..11d3414 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -ruby '2.7.1' +ruby '3.0.1' gem 'money' gem 'oj' @@ -15,14 +15,19 @@ gem 'rufus-scheduler' gem 'sequel_pg' gem 'unicorn' +group :development, :test do + gem 'pry-byebug' + gem 'rubocop-minitest' + gem 'rubocop-performance' + gem 'rubocop-rake' + gem 'rubocop-sequel' +end + group :test do gem 'minitest' gem 'minitest-around' gem 'minitest-focus' gem 'rack-test' - gem 'rubocop-minitest' - gem 'rubocop-performance' - gem 'rubocop-sequel' gem 'simplecov' gem 'vcr' gem 'webmock' diff --git a/Gemfile.lock b/Gemfile.lock index 098d6e1..24d10ad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,38 +3,46 @@ GEM specs: addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - ast (2.4.0) - concurrent-ruby (1.1.6) - crack (0.4.3) - safe_yaml (~> 1.0.0) - docile (1.3.2) + ast (2.4.2) + byebug (11.1.3) + coderay (1.1.3) + concurrent-ruby (1.1.8) + crack (0.4.5) + rexml + docile (1.3.5) et-orbi (1.2.4) tzinfo - fugit (1.3.4) + fugit (1.4.5) et-orbi (~> 1.1, >= 1.1.8) - raabro (~> 1.1) + raabro (~> 1.4) hashdiff (1.0.1) - i18n (1.8.2) + i18n (1.8.10) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.4) kgio (2.11.3) - minitest (5.14.0) + method_source (1.0.0) + minitest (5.14.4) minitest-around (0.5.0) minitest (~> 5.0) - minitest-focus (1.1.2) + minitest-focus (1.2.1) minitest (>= 4, < 6) - money (6.13.7) + money (6.14.1) i18n (>= 0.6.4, <= 2) - oj (3.10.6) - ox (2.13.2) - parallel (1.19.1) - parser (2.7.1.2) - ast (~> 2.4.0) + oj (3.11.5) + ox (2.14.4) + parallel (1.20.1) + parser (3.0.1.0) + ast (~> 2.4.1) pg (1.2.3) - public_suffix (4.0.4) - raabro (1.1.6) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.9.0) + byebug (~> 11.0) + pry (~> 0.13.0) + public_suffix (4.0.6) + raabro (1.4.0) rack (2.2.3) - rack-contrib (2.2.0) + rack-contrib (2.3.0) rack (~> 2.0) rack-cors (1.1.1) rack (>= 2.0.0) @@ -42,44 +50,52 @@ GEM rack (>= 1.0, < 3) rainbow (3.0.0) raindrops (0.19.1) - rake (13.0.1) + rake (13.0.3) + regexp_parser (2.1.1) rexml (3.2.5) - roda (3.31.0) + roda (3.43.1) rack - rubocop (0.82.0) - jaro_winkler (~> 1.5.1) + rubocop (1.13.0) parallel (~> 1.10) - parser (>= 2.7.0.1) + parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) rexml + rubocop-ast (>= 1.2.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-minitest (0.9.0) - rubocop (>= 0.74) - rubocop-performance (1.5.2) - rubocop (>= 0.71.0) - rubocop-sequel (0.0.6) - rubocop (~> 0.55, >= 0.55) - ruby-progressbar (1.10.1) - rufus-scheduler (3.6.0) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.4.1) + parser (>= 2.7.1.5) + rubocop-minitest (0.12.0) + rubocop (>= 0.90, < 2.0) + rubocop-performance (1.11.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rake (0.5.1) + rubocop + rubocop-sequel (0.2.0) + rubocop (~> 1.0) + ruby-progressbar (1.11.0) + rufus-scheduler (3.7.0) fugit (~> 1.1, >= 1.1.6) - safe_yaml (1.0.5) - sequel (5.32.0) - sequel_pg (1.13.0) + sequel (5.43.0) + sequel_pg (1.14.0) pg (>= 0.18.0, != 1.2.0) sequel (>= 4.38.0) - simplecov (0.18.5) + simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) - simplecov-html (0.12.2) - tzinfo (2.0.2) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.2) + tzinfo (2.0.4) concurrent-ruby (~> 1.0) - unicode-display_width (1.7.0) - unicorn (5.5.5) + unicode-display_width (2.0.0) + unicorn (6.0.0) kgio (~> 2.6) raindrops (~> 0.7) - vcr (5.1.0) - webmock (3.8.3) + vcr (6.0.0) + webmock (3.12.2) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -94,6 +110,7 @@ DEPENDENCIES money oj ox + pry-byebug rack-contrib rack-cors rack-test @@ -101,6 +118,7 @@ DEPENDENCIES roda rubocop-minitest rubocop-performance + rubocop-rake rubocop-sequel rufus-scheduler sequel_pg @@ -110,7 +128,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 2.7.1p83 + ruby 3.0.1p64 BUNDLED WITH - 2.1.4 + 2.2.15 diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index ed9c12e..ff2028b 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -12,9 +12,11 @@ namespace :db do Sequel::IntegerMigrator.new(db, dir, opts).run end + desc 'Run database migrations and seed data' task prepare: %w[db:migrate rates:all] namespace :test do + desc 'Run database migrations and seed with saved data' task :prepare do ENV['APP_ENV'] ||= 'test' Rake::Task['db:migrate'].invoke diff --git a/lib/tasks/environment.rake b/lib/tasks/environment.rake index 95c6e48..ac9e199 100644 --- a/lib/tasks/environment.rake +++ b/lib/tasks/environment.rake @@ -1,5 +1,6 @@ # frozen_string_literal: true +desc 'Load environment' task :environment do require './config/environment' end diff --git a/lib/tasks/rates.rake b/lib/tasks/rates.rake index 75b09f7..91f4541 100644 --- a/lib/tasks/rates.rake +++ b/lib/tasks/rates.rake @@ -19,6 +19,7 @@ namespace :rates do Bank.fetch_current! end + desc 'Seed with saved data' task :seed_with_saved_data do require 'bank' Bank.seed_with_saved_data! diff --git a/spec/helper.rb b/spec/helper.rb index bb53787..3264453 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -14,6 +14,7 @@ require_relative '../config/environment' require 'minitest/autorun' require 'minitest/around/spec' require 'minitest/focus' +require 'pry-byebug' require 'vcr' require 'webmock'