From d47f25de3b2286d092538cef59dc99c15bbe4b57 Mon Sep 17 00:00:00 2001 From: Raj Iyengar Date: Mon, 25 Apr 2022 12:54:50 -0400 Subject: [PATCH] Bump to ruby 3 and bump testing internals to Rails 6.1 --- .ruby-version | 2 +- Gemfile.lock | 171 ++++++++++-------- actionset.gemspec | 4 +- .../filtering/active_record/operators.rb | 8 +- .../filtering/active_record/query_value.rb | 2 +- 5 files changed, 104 insertions(+), 83 deletions(-) diff --git a/.ruby-version b/.ruby-version index 3f5987a..b0f2dcb 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.4.9 +3.0.4 diff --git a/Gemfile.lock b/Gemfile.lock index 37fc1ef..d4137ca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,57 +2,74 @@ PATH remote: . specs: actionset (0.11.0) - activesupport (>= 4.0.2) + activesupport railties GEM remote: https://rubygems.org/ specs: - actioncable (5.2.5) - actionpack (= 5.2.5) + actioncable (6.1.5) + actionpack (= 6.1.5) + activesupport (= 6.1.5) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.5) - actionpack (= 5.2.5) - actionview (= 5.2.5) - activejob (= 5.2.5) + actionmailbox (6.1.5) + actionpack (= 6.1.5) + activejob (= 6.1.5) + activerecord (= 6.1.5) + activestorage (= 6.1.5) + activesupport (= 6.1.5) + mail (>= 2.7.1) + actionmailer (6.1.5) + actionpack (= 6.1.5) + actionview (= 6.1.5) + activejob (= 6.1.5) + activesupport (= 6.1.5) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.5) - actionview (= 5.2.5) - activesupport (= 5.2.5) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.5) + actionview (= 6.1.5) + activesupport (= 6.1.5) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.5) - activesupport (= 5.2.5) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.5) + actionpack (= 6.1.5) + activerecord (= 6.1.5) + activestorage (= 6.1.5) + activesupport (= 6.1.5) + nokogiri (>= 1.8.5) + actionview (6.1.5) + activesupport (= 6.1.5) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.5) - activesupport (= 5.2.5) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.5) + activesupport (= 6.1.5) globalid (>= 0.3.6) - activemodel (5.2.5) - activesupport (= 5.2.5) - activerecord (5.2.5) - activemodel (= 5.2.5) - activesupport (= 5.2.5) - arel (>= 9.0) - activestorage (5.2.5) - actionpack (= 5.2.5) - activerecord (= 5.2.5) - marcel (~> 1.0.0) - activesupport (5.2.5) + activemodel (6.1.5) + activesupport (= 6.1.5) + activerecord (6.1.5) + activemodel (= 6.1.5) + activesupport (= 6.1.5) + activestorage (6.1.5) + actionpack (= 6.1.5) + activejob (= 6.1.5) + activerecord (= 6.1.5) + activesupport (= 6.1.5) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.5) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) ansi (1.5.0) - arel (9.0.0) ast (2.4.2) builder (3.2.4) capybara (3.32.2) @@ -65,11 +82,11 @@ GEM xpath (~> 3.2) codecov (0.5.1) simplecov (>= 0.15, < 0.22) - combustion (1.3.1) + combustion (1.3.5) activesupport (>= 3.0.0) railties (>= 3.0.0) thor (>= 0.14.6) - concurrent-ruby (1.1.8) + concurrent-ruby (1.1.10) crass (1.0.6) database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) @@ -84,56 +101,60 @@ GEM activesupport (>= 4.2.0) faker (2.12.0) i18n (>= 1.6, < 2) - globalid (0.4.2) - activesupport (>= 4.2.0) - i18n (1.8.10) + globalid (1.0.0) + activesupport (>= 5.0) + i18n (1.10.0) concurrent-ruby (~> 1.0) - loofah (2.9.1) + loofah (2.16.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (1.0.1) + marcel (1.0.2) method_source (1.0.0) - mini_mime (1.1.0) - mini_portile2 (2.4.0) - minitest (5.14.4) - nio4r (2.5.7) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) + mini_mime (1.1.2) + mini_portile2 (2.8.0) + minitest (5.15.0) + nio4r (2.5.8) + nokogiri (1.13.4) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) parallel (1.20.1) parser (3.0.1.0) ast (~> 2.4.1) public_suffix (4.0.6) + racc (1.6.0) rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.5) - actioncable (= 5.2.5) - actionmailer (= 5.2.5) - actionpack (= 5.2.5) - actionview (= 5.2.5) - activejob (= 5.2.5) - activemodel (= 5.2.5) - activerecord (= 5.2.5) - activestorage (= 5.2.5) - activesupport (= 5.2.5) - bundler (>= 1.3.0) - railties (= 5.2.5) + rails (6.1.5) + actioncable (= 6.1.5) + actionmailbox (= 6.1.5) + actionmailer (= 6.1.5) + actionpack (= 6.1.5) + actiontext (= 6.1.5) + actionview (= 6.1.5) + activejob (= 6.1.5) + activemodel (= 6.1.5) + activerecord (= 6.1.5) + activestorage (= 6.1.5) + activesupport (= 6.1.5) + bundler (>= 1.15.0) + railties (= 6.1.5) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) + rails-html-sanitizer (1.4.2) loofah (~> 2.3) - railties (5.2.5) - actionpack (= 5.2.5) - activesupport (= 5.2.5) + railties (6.1.5) + actionpack (= 6.1.5) + activesupport (= 6.1.5) method_source - rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + rake (>= 12.2) + thor (~> 1.0) rainbow (3.0.0) - rake (13.0.3) + rake (13.0.6) ransack (2.4.1) activerecord (>= 5.2.4) activesupport (>= 5.2.4) @@ -181,26 +202,26 @@ GEM simplecov terminal-table simplecov-html (0.12.3) - sprockets (3.7.2) + sprockets (4.0.3) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) sqlite3 (1.4.2) terminal-table (3.0.0) unicode-display_width (~> 1.1, >= 1.1.1) - thor (1.1.0) - thread_safe (0.3.6) - tzinfo (1.2.9) - thread_safe (~> 0.1) + thor (1.2.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) unicode-display_width (1.7.0) - websocket-driver (0.7.3) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.5.4) PLATFORMS ruby @@ -216,7 +237,7 @@ DEPENDENCIES database_cleaner factory_bot faker - rails (~> 5.2.0) + rails (~> 6.1.0) rake ransack rspec @@ -227,4 +248,4 @@ DEPENDENCIES sqlite3 BUNDLED WITH - 2.1.4 + 2.2.33 diff --git a/actionset.gemspec b/actionset.gemspec index 4c65f2d..6469f3c 100644 --- a/actionset.gemspec +++ b/actionset.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_dependency 'activesupport', '>= 4.0.2' + spec.add_dependency 'activesupport' spec.add_dependency 'railties' spec.add_development_dependency 'bundler' @@ -32,7 +32,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'database_cleaner' spec.add_development_dependency 'factory_bot' spec.add_development_dependency 'faker' - spec.add_development_dependency 'rails', '~> 5.2.0' + spec.add_development_dependency 'rails', '~> 6.1.0' spec.add_development_dependency 'rake' spec.add_development_dependency 'ransack' spec.add_development_dependency 'rspec' diff --git a/lib/active_set/filtering/active_record/operators.rb b/lib/active_set/filtering/active_record/operators.rb index 3c16319..d7dccaf 100644 --- a/lib/active_set/filtering/active_record/operators.rb +++ b/lib/active_set/filtering/active_record/operators.rb @@ -15,7 +15,7 @@ module Operators end end BLANK_TRANSFORMER = proc do |type:, **_ctx| - if type.presence_in %i[date float integer time datetime boolean] + if type.presence_in %i[date float integer time datetime boolean decimal] [nil] else Constants::BLANK_VALUES @@ -34,7 +34,7 @@ module Operators next sql.map { |str| START_MATCHER_TRANSFORMER.call(sql: str, type: type, **ctx) } if sql.respond_to?(:map) str = MATCHER_TRANSFORMER.call(sql: sql, type: type, **ctx) - next str if ['boolean'].include? type.to_s + next str if ['boolean', 'decimal'].include? type.to_s str + '%' end @@ -42,7 +42,7 @@ module Operators next sql.map { |str| END_MATCHER_TRANSFORMER.call(sql: str, type: type, **ctx) } if sql.respond_to?(:map) str = MATCHER_TRANSFORMER.call(sql: sql, type: type, **ctx) - next str if ['boolean'].include? type.to_s + next str if ['boolean', 'decimal'].include? type.to_s '%' + str end @@ -50,7 +50,7 @@ module Operators next sql.map { |str| CONTAIN_MATCHER_TRANSFORMER.call(sql: str, type: type, **ctx) } if sql.respond_to?(:map) str = MATCHER_TRANSFORMER.call(sql: sql, type: type, **ctx) - next str if ['boolean'].include? type.to_s + next str if ['boolean', 'decimal'].include? type.to_s '%' + str + '%' end diff --git a/lib/active_set/filtering/active_record/query_value.rb b/lib/active_set/filtering/active_record/query_value.rb index b125301..cd61fea 100644 --- a/lib/active_set/filtering/active_record/query_value.rb +++ b/lib/active_set/filtering/active_record/query_value.rb @@ -25,7 +25,7 @@ def query_attribute_for(value) type: arel_type } - operator_hash[:query_attribute_transformer].call(context) + operator_hash[:query_attribute_transformer].call(**context) end def to_sql_str(value)