From 0fab65ecabcc7ea721054fb8c3c23e74013c4dcd Mon Sep 17 00:00:00 2001 From: Kshitij Sobti Date: Thu, 3 Nov 2022 16:43:54 +0530 Subject: [PATCH] fix: tests and dependencies --- Gemfile | 6 +-- Gemfile.lock | 50 ++++++++++++----------- Gemfile3 | 18 ++------- Gemfile3.lock | 96 +++++++++++++++++++------------------------- app.rb | 2 +- presenters/thread.rb | 2 +- 6 files changed, 76 insertions(+), 98 deletions(-) diff --git a/Gemfile b/Gemfile index 7cb25b2574b..e1d11fb65cd 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ gem 'bundler' gem 'rake' -gem 'sinatra', '< 2.0' +gem 'sinatra' gem 'sinatra-param', '~> 1.4' gem 'yajl-ruby', '~> 1.3.1' @@ -19,7 +19,7 @@ gem 'yajl-ruby', '~> 1.3.1' gem 'activemodel' gem 'protected_attributes_continued' -gem 'mongoid', '~>7.0.0' +gem 'mongoid' gem 'bson' gem 'bson_ext' @@ -53,7 +53,7 @@ group :test do gem 'guard' gem 'guard-unicorn' gem 'rack-test', :require => 'rack/test' - gem 'rspec', '~> 3.6.0' + gem 'rspec' gem 'rspec-its' gem 'rspec-collection_matchers' gem 'webmock' diff --git a/Gemfile.lock b/Gemfile.lock index 19b0bb98c1a..8c341453dc7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,9 +118,10 @@ GEM minitest (5.15.0) mongo (2.18.1) bson (>= 4.14.1, < 5.0.0) - mongoid (7.0.13) - activemodel (>= 5.1, < 6.2) - mongo (>= 2.7.0, < 3.0.0) + mongoid (7.5.1) + activemodel (>= 5.1, < 7.1, != 7.0.0) + mongo (>= 2.10.5, < 3.0.0) + ruby2_keywords (~> 0.0.5) mongoid_cleaner (1.2.0) mongoid (>= 4.0) mongoid_magic_counter_cache (1.1.1) @@ -128,6 +129,8 @@ GEM rake multi_json (1.15.0) multipart-post (2.2.3) + mustermann (2.0.2) + ruby2_keywords (~> 0.0.1) nenv (0.3.0) netrc (0.11.0) newrelic_rpm (8.12.0) @@ -144,8 +147,8 @@ GEM pry-nav (1.0.0) pry (>= 0.9.10, < 0.15) public_suffix (4.0.7) - rack (1.6.13) - rack-protection (1.5.5) + rack (2.2.4) + rack-protection (2.2.2) rack rack-test (2.0.2) rack (>= 1.3) @@ -164,24 +167,24 @@ GEM rexml (3.2.5) rs_voteable_mongo (1.3.0) mongoid (~> 7.0) - rspec (3.6.0) - rspec-core (~> 3.6.0) - rspec-expectations (~> 3.6.0) - rspec-mocks (~> 3.6.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) rspec-collection_matchers (1.2.0) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.6.0) - rspec-support (~> 3.6.0) - rspec-expectations (3.6.0) + rspec-core (3.12.0) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) + rspec-support (~> 3.12.0) rspec-its (1.3.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.6.0) + rspec-mocks (3.12.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-support (3.6.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.0) ruby2_keywords (0.0.5) shellany (0.0.1) simplecov (0.21.2) @@ -190,10 +193,11 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sinatra (1.4.8) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) + sinatra (2.2.2) + mustermann (~> 2.0) + rack (~> 2.2) + rack-protection (= 2.2.2) + tilt (~> 2.0) sinatra-param (1.6.0) sinatra (>= 1.3) thor (1.2.1) @@ -238,7 +242,7 @@ DEPENDENCIES guard guard-unicorn i18n - mongoid (~> 7.0.0) + mongoid mongoid-tree! mongoid_cleaner (~> 1.2.0) mongoid_magic_counter_cache @@ -254,10 +258,10 @@ DEPENDENCIES rdiscount rest-client rs_voteable_mongo (~> 1.3) - rspec (~> 3.6.0) + rspec rspec-collection_matchers rspec-its - sinatra (< 2.0) + sinatra sinatra-param (~> 1.4) timecop (~> 0.9.5) unicorn diff --git a/Gemfile3 b/Gemfile3 index 7b9e07045cd..3e13228eb8f 100644 --- a/Gemfile3 +++ b/Gemfile3 @@ -9,14 +9,14 @@ gem 'pry-nav' gem 'bundler' -gem 'rake', '~> 12.3.3' +gem 'rake' gem 'sinatra' gem 'sinatra-param', '~> 1.4' gem 'yajl-ruby', '~> 1.3.1' -gem 'activemodel', '~> 6.0.3.1' +gem 'activemodel' gem 'protected_attributes_continued' gem 'mongoid' @@ -45,18 +45,6 @@ gem 'dalli' gem 'rest-client' -gem 'rubyzip', '~> 1.2.2' - -gem 'ffi', '~> 1.9.24' - -gem 'faye-websocket', '~> 0.11.0' - -gem 'addressable', '~> 2.8.0' - -gem 'activesupport', '~> 6.0.3.1' - -gem 'rack-protection', '~> 1.5.5' - group :test do gem 'codecov', :require => false gem 'mongoid_cleaner', '~> 1.2.0' @@ -65,7 +53,7 @@ group :test do gem 'guard' gem 'guard-unicorn' gem 'rack-test', :require => 'rack/test' - gem 'rspec', '~> 3.6.0' + gem 'rspec' gem 'rspec-its' gem 'rspec-collection_matchers' gem 'webmock' diff --git a/Gemfile3.lock b/Gemfile3.lock index 27da1a6fa98..8335cfaa0d8 100644 --- a/Gemfile3.lock +++ b/Gemfile3.lock @@ -16,14 +16,13 @@ GIT GEM remote: https://rubygems.org/ specs: - activemodel (6.0.3.7) - activesupport (= 6.0.3.7) - activesupport (6.0.3.7) + activemodel (7.0.4) + activesupport (= 7.0.4) + activesupport (7.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) addressable (2.8.1) public_suffix (>= 2.0.2, < 6.0) bson (4.15.0) @@ -34,8 +33,8 @@ GEM concurrent-ruby (1.1.10) crack (0.4.5) rexml - dalli (3.2.2) - delayed_job (4.1.10) + dalli (3.2.3) + delayed_job (4.1.11) activesupport (>= 3.0, < 8.0) delayed_job_mongoid (3.0.0) delayed_job (>= 3.0, < 5) @@ -58,10 +57,9 @@ GEM multi_json enumerize (2.5.0) activesupport (>= 3.2) - eventmachine (1.2.7) factory_bot (6.2.1) activesupport (>= 5.0.0) - faker (2.23.0) + faker (3.0.0) i18n (>= 1.8.11, < 2) faraday (1.10.2) faraday-em_http (~> 1.0) @@ -86,10 +84,7 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faye-websocket (0.11.1) - eventmachine (>= 0.12.0) - websocket-driver (>= 0.5.1) - ffi (1.9.25) + ffi (1.15.5) formatador (1.1.0) guard (2.18.0) formatador (>= 0.2.4) @@ -133,9 +128,11 @@ GEM rake multi_json (1.15.0) multipart-post (2.2.3) + mustermann (3.0.0) + ruby2_keywords (~> 0.0.1) nenv (0.3.0) netrc (0.11.0) - newrelic_rpm (8.10.1) + newrelic_rpm (8.12.0) nokogiri (1.8.5) mini_portile2 (~> 2.3.0) notiffany (0.1.3) @@ -149,18 +146,18 @@ GEM pry-nav (1.0.0) pry (>= 0.9.10, < 0.15) public_suffix (5.0.0) - rack (1.6.13) - rack-protection (1.5.5) + rack (2.2.4) + rack-protection (3.0.2) rack rack-test (2.0.2) rack (>= 1.3) rack-timeout (0.6.3) raindrops (0.20.0) - rake (12.3.3) + rake (13.0.6) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rdiscount (2.2.0.2) + rdiscount (2.2.7) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) @@ -169,26 +166,25 @@ GEM rexml (3.2.5) rs_voteable_mongo (1.3.0) mongoid (~> 7.0) - rspec (3.6.0) - rspec-core (~> 3.6.0) - rspec-expectations (~> 3.6.0) - rspec-mocks (~> 3.6.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) rspec-collection_matchers (1.2.0) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.6.0) - rspec-support (~> 3.6.0) - rspec-expectations (3.6.0) + rspec-core (3.12.0) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) + rspec-support (~> 3.12.0) rspec-its (1.3.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.6.0) + rspec-mocks (3.12.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-support (3.6.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.0) ruby2_keywords (0.0.5) - rubyzip (1.2.4) shellany (0.0.1) simplecov (0.21.2) docile (~> 1.1) @@ -196,18 +192,18 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sinatra (1.4.8) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) + sinatra (3.0.2) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.0.2) + tilt (~> 2.0) sinatra-param (1.6.0) sinatra (>= 1.3) thor (1.2.1) - thread_safe (0.3.6) tilt (2.0.11) timecop (0.9.5) - tzinfo (1.2.10) - thread_safe (~> 0.1) + tzinfo (2.0.5) + concurrent-ruby (~> 1.0) unf (0.1.4) unf_ext unf_ext (0.0.8.2) @@ -218,23 +214,17 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) will_paginate (3.3.1) will_paginate_mongoid (2.0.1) mongoid will_paginate (~> 3.0) yajl-ruby (1.3.1) - zeitwerk (2.6.0) PLATFORMS - ruby + x86_64-linux DEPENDENCIES - activemodel (~> 6.0.3.1) - activesupport (~> 6.0.3.1) - addressable (~> 2.8.0) + activemodel bson bson_ext bundler @@ -247,8 +237,6 @@ DEPENDENCIES enumerize factory_bot faker - faye-websocket (~> 0.11.0) - ffi (~> 1.9.24) guard guard-unicorn i18n @@ -262,17 +250,15 @@ DEPENDENCIES pry pry-nav rack-contrib! - rack-protection (~> 1.5.5) rack-test rack-timeout - rake (~> 12.3.3) + rake rdiscount rest-client rs_voteable_mongo (~> 1.3) - rspec (~> 3.6.0) + rspec rspec-collection_matchers rspec-its - rubyzip (~> 1.2.2) sinatra sinatra-param (~> 1.4) timecop (~> 0.9.5) @@ -282,7 +268,7 @@ DEPENDENCIES yajl-ruby (~> 1.3.1) RUBY VERSION - ruby 3.0.1p64 + ruby 3.0.4p208 BUNDLED WITH - 1.17.3 + 2.2.33 diff --git a/app.rb b/app.rb index 14eb6b0086d..565641c3713 100644 --- a/app.rb +++ b/app.rb @@ -45,7 +45,7 @@ def search_enabled? def get_logger(progname, threshold=nil) logger = Logger.new(STDERR) logger.progname = progname - logger.level = threshold || Logger::INFO + logger.level = threshold || Logger::WARN logger end diff --git a/presenters/thread.rb b/presenters/thread.rb index 71513f7c2f6..05bd7a2ff82 100644 --- a/presenters/thread.rb +++ b/presenters/thread.rb @@ -96,7 +96,7 @@ def get_paged_merged_responses(thread_id, responses, skip, limit, recursive=fals paged_response_ids = limit.nil? ? response_ids.drop(skip) : response_ids.drop(skip).take(limit) if recursive content = Comment.where(comment_thread_id: thread_id). - or({:parent_id => {"$in" => paged_response_ids}}, {:id => {"$in" => paged_response_ids}}). + any_of({:parent_id => {"$in" => paged_response_ids}}, {:id => {"$in" => paged_response_ids}}). sort({"sk" => 1}) else content = Comment.where(comment_thread_id: thread_id, "parent_ids" => []).