diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 071b80884..8743cd29b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -102,7 +102,7 @@ jobs: BUNDLE_JOBS: 4 BUNDLE_RETRY: 3 BUNDLE_PATH: vendor/bundle - BUNDLE_WITHOUT: lint + BUNDLE_WITHOUT: debug:lint:demo:production RAILS_LOG_TO_STDOUT: false services: postgres: diff --git a/Gemfile b/Gemfile index 99e56f9f8..086f5ef42 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gemspec # your gem to rubygems.org. gem 'activerecord-jdbcpostgresql-adapter', platforms: [:jruby] -gem 'appraisal', github: 'thoughtbot/appraisal', branch: 'main' +gem 'appraisal' gem 'matrix' gem 'nokogiri' gem 'pg', platforms: [:mri, :mingw, :x64_mingw] @@ -22,7 +22,6 @@ gem 'rack', '~> 2.2' gem 'rails' platforms :ruby do - gem "activerecord-explain-analyze", require: false gem "dotenv" gem "foreman" gem "gem-release" @@ -30,12 +29,14 @@ platforms :ruby do gem "net-imap", require: false gem "net-pop", require: false gem "net-smtp", require: false - gem "pry-byebug" - gem "rack-mini-profiler" - gem "rbtrace" - gem "stackprof" - gem "tapioca", require: false, group: :development + group :debug do + gem "activerecord-explain-analyze", require: false + gem "pry-byebug" + gem "rack-mini-profiler" + gem "rbtrace" + gem "stackprof" + end group :lint do gem "easy_translate" @@ -49,5 +50,10 @@ platforms :ruby do gem "sorbet" gem "sorbet-runtime" gem "spoom", require: false + gem "tapioca", require: false + end + + group :demo, :production do + gem "skylight" end end diff --git a/Gemfile.lock b/Gemfile.lock index b47b65326..075440355 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,3 @@ -GIT - remote: https://github.com/thoughtbot/appraisal.git - revision: feb78bcc6177038399bff098cb6c2bd4bca4972a - branch: main - specs: - appraisal (2.5.0) - bundler - rake - thor (>= 0.14.0) - PATH remote: . specs: @@ -22,59 +12,59 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.7.2) - actionpack (= 7.0.7.2) - activesupport (= 7.0.7.2) + actioncable (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.7.2) - actionpack (= 7.0.7.2) - activejob (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + actionmailbox (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.7.2) - actionpack (= 7.0.7.2) - actionview (= 7.0.7.2) - activejob (= 7.0.7.2) - activesupport (= 7.0.7.2) + actionmailer (7.0.8) + actionpack (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activesupport (= 7.0.8) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.7.2) - actionview (= 7.0.7.2) - activesupport (= 7.0.7.2) + actionpack (7.0.8) + actionview (= 7.0.8) + activesupport (= 7.0.8) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.7.2) - actionpack (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + actiontext (7.0.8) + actionpack (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.7.2) - activesupport (= 7.0.7.2) + actionview (7.0.8) + activesupport (= 7.0.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.7.2) - activesupport (= 7.0.7.2) + activejob (7.0.8) + activesupport (= 7.0.8) globalid (>= 0.3.6) - activemodel (7.0.7.2) - activesupport (= 7.0.7.2) - activerecord (7.0.7.2) - activemodel (= 7.0.7.2) - activesupport (= 7.0.7.2) + activemodel (7.0.8) + activesupport (= 7.0.8) + activerecord (7.0.8) + activemodel (= 7.0.8) + activesupport (= 7.0.8) activerecord-explain-analyze (0.1.0) activerecord (>= 4) pg @@ -83,20 +73,24 @@ GEM activerecord-jdbcpostgresql-adapter (70.1-java) activerecord-jdbc-adapter (= 70.1) jdbc-postgres (>= 9.4, < 43) - activestorage (7.0.7.2) - actionpack (= 7.0.7.2) - activejob (= 7.0.7.2) - activerecord (= 7.0.7.2) - activesupport (= 7.0.7.2) + activestorage (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activesupport (= 7.0.8) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.7.2) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) ast (2.4.2) async (2.6.4) console (~> 1.10) @@ -114,7 +108,7 @@ GEM async-http-faraday (0.12.0) async-http (~> 0.42) faraday - async-io (1.35.0) + async-io (1.36.0) async async-pool (0.4.0) async (>= 1.25) @@ -187,7 +181,7 @@ GEM octokit (~> 4.6) rainbow (>= 2.2.1) rake (>= 10.0) - globalid (1.2.0) + globalid (1.2.1) activesupport (>= 6.1) highline (2.1.0) i18n (1.14.1) @@ -230,7 +224,7 @@ GEM mixlib-shellout method_source (1.0.0) mini_mime (1.1.5) - minitest (5.19.0) + minitest (5.20.0) mixlib-cli (2.1.8) mixlib-config (3.0.27) tomlrb @@ -301,20 +295,20 @@ GEM rack (>= 1.2.0) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.7.2) - actioncable (= 7.0.7.2) - actionmailbox (= 7.0.7.2) - actionmailer (= 7.0.7.2) - actionpack (= 7.0.7.2) - actiontext (= 7.0.7.2) - actionview (= 7.0.7.2) - activejob (= 7.0.7.2) - activemodel (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + rails (7.0.8) + actioncable (= 7.0.8) + actionmailbox (= 7.0.8) + actionmailer (= 7.0.8) + actionpack (= 7.0.8) + actiontext (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activemodel (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) bundler (>= 1.15.0) - railties (= 7.0.7.2) + railties (= 7.0.8) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -325,9 +319,9 @@ GEM rails-i18n (7.0.8) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.7.2) - actionpack (= 7.0.7.2) - activesupport (= 7.0.7.2) + railties (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) method_source rake (>= 12.2) thor (~> 1.0) @@ -362,7 +356,7 @@ GEM rspec-mocks (~> 3.12) rspec-support (~> 3.12) rspec-support (3.12.1) - rubocop (1.56.2) + rubocop (1.56.3) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -383,11 +377,11 @@ GEM rubocop-performance (1.19.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.20.2) + rubocop-rails (2.21.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.23.2) + rubocop-rspec (2.24.0) rubocop (~> 1.33) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) @@ -401,25 +395,18 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) + skylight (5.3.4) + activesupport (>= 5.2.0) smart_properties (1.17.0) - sorbet (0.5.11001) - sorbet-static (= 0.5.11001) - sorbet-runtime (0.5.11001) - sorbet-static (0.5.11001-java) - sorbet-static (0.5.11001-universal-darwin-14) - sorbet-static (0.5.11001-universal-darwin-15) - sorbet-static (0.5.11001-universal-darwin-16) - sorbet-static (0.5.11001-universal-darwin-17) - sorbet-static (0.5.11001-universal-darwin-18) - sorbet-static (0.5.11001-universal-darwin-19) - sorbet-static (0.5.11001-universal-darwin-20) - sorbet-static (0.5.11001-universal-darwin-21) - sorbet-static (0.5.11001-universal-darwin-22) - sorbet-static (0.5.11001-universal-darwin-23) - sorbet-static (0.5.11001-x86_64-linux) - sorbet-static-and-runtime (0.5.11001) - sorbet (= 0.5.11001) - sorbet-runtime (= 0.5.11001) + sorbet (0.5.11011) + sorbet-static (= 0.5.11011) + sorbet-runtime (0.5.11011) + sorbet-static (0.5.11011-java) + sorbet-static (0.5.11011-universal-darwin) + sorbet-static (0.5.11011-x86_64-linux) + sorbet-static-and-runtime (0.5.11011) + sorbet (= 0.5.11011) + sorbet-runtime (= 0.5.11011) spoom (1.2.3) erubi (>= 1.10.0) sorbet-static-and-runtime (>= 0.5.10187) @@ -473,6 +460,7 @@ GEM PLATFORMS arm64-darwin + arm64-darwin-22 java universal-java-11 universal-java-17 @@ -482,7 +470,7 @@ PLATFORMS DEPENDENCIES activerecord-explain-analyze activerecord-jdbcpostgresql-adapter - appraisal! + appraisal benchmark-ips capybara dotenv @@ -515,6 +503,7 @@ DEPENDENCIES rubocop-rails rubocop-rspec selenium-webdriver + skylight sorbet sorbet-runtime spoom @@ -524,4 +513,4 @@ DEPENDENCIES yard-activesupport-concern BUNDLED WITH - 2.4.14 + 2.4.19 diff --git a/app/filters/good_job/batches_filter.rb b/app/filters/good_job/batches_filter.rb index 18c55f9a3..525101651 100644 --- a/app/filters/good_job/batches_filter.rb +++ b/app/filters/good_job/batches_filter.rb @@ -16,7 +16,7 @@ def filtered_query(_filtered_params = params) end def default_base_query - GoodJob::BatchRecord.all.includes(:jobs) + GoodJob::BatchRecord.includes(:jobs) end end end diff --git a/gemfiles/bin/bundle b/gemfiles/bin/bundle new file mode 100755 index 000000000..8d10a164b --- /dev/null +++ b/gemfiles/bin/bundle @@ -0,0 +1,109 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "rubygems" + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end + + def env_var_version + ENV["BUNDLER_VERSION"] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV["BUNDLE_GEMFILE"] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path("../rails_7.0_ruby_3.1.gemfile", __dir__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, ".locked") + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end + + def bundler_requirement + @bundler_requirement ||= + env_var_version || + cli_arg_version || + bundler_requirement_for(lockfile_version) + end + + def bundler_requirement_for(version) + return "#{Gem::Requirement.default}.a" unless version + + bundler_gem_version = Gem::Version.new(version) + + bundler_gem_version.approximate_recommendation + end + + def load_bundler! + ENV["BUNDLE_GEMFILE"] ||= gemfile + + activate_bundler + end + + def activate_bundler + gem_error = activation_error_handling do + gem "bundler", bundler_requirement + end + return if gem_error.nil? + require_error = activation_error_handling do + require "bundler/version" + end + return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +if m.invoked_as_script? + load Gem.bin_path("bundler", "bundle") +end diff --git a/gemfiles/rails_6.0.gemfile b/gemfiles/rails_6.0.gemfile index c7ddb6942..e45644609 100644 --- a/gemfiles/rails_6.0.gemfile +++ b/gemfiles/rails_6.0.gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" gem "activerecord-jdbcpostgresql-adapter", platforms: [:jruby] -gem "appraisal", branch: "main", git: "https://github.com/thoughtbot/appraisal.git" +gem "appraisal" gem "matrix" gem "nokogiri" gem "pg", platforms: [:mri, :mingw, :x64_mingw] @@ -12,7 +12,6 @@ gem "rails", "~> 6.0.0" gem "traces", "~> 0.9.1" platforms :ruby do - gem "activerecord-explain-analyze", require: false gem "dotenv" gem "foreman" gem "gem-release" @@ -20,11 +19,14 @@ platforms :ruby do gem "net-imap", require: false gem "net-pop", require: false gem "net-smtp", require: false - gem "pry-byebug" - gem "rack-mini-profiler" - gem "rbtrace" - gem "stackprof" - gem "tapioca", require: false, group: :development + + group :debug do + gem "activerecord-explain-analyze", require: false + gem "pry-byebug" + gem "rack-mini-profiler" + gem "rbtrace" + gem "stackprof" + end group :lint do gem "easy_translate" @@ -38,6 +40,11 @@ platforms :ruby do gem "sorbet" gem "sorbet-runtime" gem "spoom", require: false + gem "tapioca", require: false + end + + group :demo, :production do + gem "skylight" end end diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile index 78d33a3ec..421cb2124 100644 --- a/gemfiles/rails_6.1.gemfile +++ b/gemfiles/rails_6.1.gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" gem "activerecord-jdbcpostgresql-adapter", platforms: [:jruby] -gem "appraisal", branch: "main", git: "https://github.com/thoughtbot/appraisal.git" +gem "appraisal" gem "matrix" gem "nokogiri" gem "pg", platforms: [:mri, :mingw, :x64_mingw] @@ -12,7 +12,6 @@ gem "rails", "~> 6.1.0" gem "traces", "~> 0.9.1" platforms :ruby do - gem "activerecord-explain-analyze", require: false gem "dotenv" gem "foreman" gem "gem-release" @@ -20,11 +19,14 @@ platforms :ruby do gem "net-imap", require: false gem "net-pop", require: false gem "net-smtp", require: false - gem "pry-byebug" - gem "rack-mini-profiler" - gem "rbtrace" - gem "stackprof" - gem "tapioca", require: false, group: :development + + group :debug do + gem "activerecord-explain-analyze", require: false + gem "pry-byebug" + gem "rack-mini-profiler" + gem "rbtrace" + gem "stackprof" + end group :lint do gem "easy_translate" @@ -38,6 +40,11 @@ platforms :ruby do gem "sorbet" gem "sorbet-runtime" gem "spoom", require: false + gem "tapioca", require: false + end + + group :demo, :production do + gem "skylight" end end diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index dd5451b93..ed0af778f 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" gem "activerecord-jdbcpostgresql-adapter", platforms: [:jruby] -gem "appraisal", branch: "main", git: "https://github.com/thoughtbot/appraisal.git" +gem "appraisal" gem "matrix" gem "nokogiri" gem "pg", platforms: [:mri, :mingw, :x64_mingw] @@ -12,7 +12,6 @@ gem "rails", "~> 7.0.0" gem "selenium-webdriver", "~> 4.0" platforms :ruby do - gem "activerecord-explain-analyze", require: false gem "dotenv" gem "foreman" gem "gem-release" @@ -20,11 +19,14 @@ platforms :ruby do gem "net-imap", require: false gem "net-pop", require: false gem "net-smtp", require: false - gem "pry-byebug" - gem "rack-mini-profiler" - gem "rbtrace" - gem "stackprof" - gem "tapioca", require: false, group: :development + + group :debug do + gem "activerecord-explain-analyze", require: false + gem "pry-byebug" + gem "rack-mini-profiler" + gem "rbtrace" + gem "stackprof" + end group :lint do gem "easy_translate" @@ -38,6 +40,11 @@ platforms :ruby do gem "sorbet" gem "sorbet-runtime" gem "spoom", require: false + gem "tapioca", require: false + end + + group :demo, :production do + gem "skylight" end end diff --git a/gemfiles/rails_7.0_ruby_3.1.gemfile b/gemfiles/rails_7.0_ruby_3.1.gemfile index eff286ac3..8cdc23c20 100644 --- a/gemfiles/rails_7.0_ruby_3.1.gemfile +++ b/gemfiles/rails_7.0_ruby_3.1.gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" gem "activerecord-jdbcpostgresql-adapter", platforms: [:jruby] -gem "appraisal", branch: "main", git: "https://github.com/thoughtbot/appraisal.git" +gem "appraisal" gem "matrix" gem "nokogiri" gem "pg", platforms: [:mri, :mingw, :x64_mingw] @@ -13,7 +13,6 @@ gem "capybara", "~> 3.36" gem "selenium-webdriver", "~> 4.0" platforms :ruby do - gem "activerecord-explain-analyze", require: false gem "dotenv" gem "foreman" gem "gem-release" @@ -21,11 +20,14 @@ platforms :ruby do gem "net-imap", require: false gem "net-pop", require: false gem "net-smtp", require: false - gem "pry-byebug" - gem "rack-mini-profiler" - gem "rbtrace" - gem "stackprof" - gem "tapioca", require: false, group: :development + + group :debug do + gem "activerecord-explain-analyze", require: false + gem "pry-byebug" + gem "rack-mini-profiler" + gem "rbtrace" + gem "stackprof" + end group :lint do gem "easy_translate" @@ -39,6 +41,11 @@ platforms :ruby do gem "sorbet" gem "sorbet-runtime" gem "spoom", require: false + gem "tapioca", require: false + end + + group :demo, :production do + gem "skylight" end end diff --git a/gemfiles/rails_head.gemfile b/gemfiles/rails_head.gemfile index 2794ba907..901c1bffe 100644 --- a/gemfiles/rails_head.gemfile +++ b/gemfiles/rails_head.gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" gem "activerecord-jdbcpostgresql-adapter", platforms: [:jruby] -gem "appraisal", branch: "main", git: "https://github.com/thoughtbot/appraisal.git" +gem "appraisal" gem "matrix" gem "nokogiri" gem "pg", platforms: [:mri, :mingw, :x64_mingw] @@ -13,7 +13,6 @@ gem "capybara", "~> 3.36" gem "selenium-webdriver", "~> 4.0" platforms :ruby do - gem "activerecord-explain-analyze", require: false gem "dotenv" gem "foreman" gem "gem-release" @@ -21,11 +20,14 @@ platforms :ruby do gem "net-imap", require: false gem "net-pop", require: false gem "net-smtp", require: false - gem "pry-byebug" - gem "rack-mini-profiler" - gem "rbtrace" - gem "stackprof" - gem "tapioca", require: false, group: :development + + group :debug do + gem "activerecord-explain-analyze", require: false + gem "pry-byebug" + gem "rack-mini-profiler" + gem "rbtrace" + gem "stackprof" + end group :lint do gem "easy_translate" @@ -39,6 +41,11 @@ platforms :ruby do gem "sorbet" gem "sorbet-runtime" gem "spoom", require: false + gem "tapioca", require: false + end + + group :demo, :production do + gem "skylight" end end diff --git a/spec/app/models/good_job/execution_spec.rb b/spec/app/models/good_job/execution_spec.rb index dc1f72cc7..ba0f987eb 100644 --- a/spec/app/models/good_job/execution_spec.rb +++ b/spec/app/models/good_job/execution_spec.rb @@ -177,12 +177,12 @@ def job_params 4.times do described_class.perform_with_advisory_lock end - expect(described_class.all.order(finished_at: :asc).to_a).to eq([ - high_priority_job, - older_job, - newer_job, - low_priority_job, - ]) + expect(described_class.order(finished_at: :asc).to_a).to eq([ + high_priority_job, + older_job, + newer_job, + low_priority_job, + ]) end end @@ -199,10 +199,10 @@ def job_params 2.times do described_class.perform_with_advisory_lock(parsed_queues: parsed_queues) end - expect(described_class.all.order(finished_at: :asc).to_a).to eq([ - queue_one_job, - queue_two_job, - ]) + expect(described_class.order(finished_at: :asc).to_a).to eq([ + queue_one_job, + queue_two_job, + ]) end end end diff --git a/spec/generators/good_job/install_generator_spec.rb b/spec/generators/good_job/install_generator_spec.rb index 9b14243c1..5401c98fa 100644 --- a/spec/generators/good_job/install_generator_spec.rb +++ b/spec/generators/good_job/install_generator_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'generators/good_job/install_generator' -describe GoodJob::InstallGenerator, skip_if_java: true, type: :generator do +describe GoodJob::InstallGenerator, :skip_if_java, type: :generator do around do |example| quiet { setup_example_app } example.run diff --git a/spec/generators/good_job/update_generator_spec.rb b/spec/generators/good_job/update_generator_spec.rb index e5daaae7e..c5223d450 100644 --- a/spec/generators/good_job/update_generator_spec.rb +++ b/spec/generators/good_job/update_generator_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'generators/good_job/update_generator' -describe GoodJob::UpdateGenerator, skip_if_java: true, type: :generator do +describe GoodJob::UpdateGenerator, :skip_if_java, type: :generator do context 'when running the generator alone' do around do |example| within_example_app do diff --git a/spec/integration/adapter_spec.rb b/spec/integration/adapter_spec.rb index cc1a6e635..b94b5c2a0 100644 --- a/spec/integration/adapter_spec.rb +++ b/spec/integration/adapter_spec.rb @@ -107,7 +107,7 @@ def perform(*_args, **_kwargs) let(:capsule) { GoodJob::Capsule.new(configuration: GoodJob::Configuration.new({ max_threads: 5, queue_string: '*' })) } let(:adapter) { GoodJob::Adapter.new(execution_mode: :async_all, _capsule: capsule) } - it 'executes the job', skip_if_java: true do + it 'executes the job', :skip_if_java do elephant_adapter = GoodJob::Adapter.new execution_mode: :async_all elephant_ajob = TestJob.set(queue: 'elephants').perform_later diff --git a/spec/integration/server_spec.rb b/spec/integration/server_spec.rb index 438d25a1c..43dcb116b 100644 --- a/spec/integration/server_spec.rb +++ b/spec/integration/server_spec.rb @@ -4,7 +4,7 @@ require 'uri' require 'net/http' -RSpec.describe 'Server modes', skip_if_java: true do +RSpec.describe 'Server modes', :skip_if_java do let(:port) { 3009 } let(:pidfile) { Rails.root.join('tmp/pids/test_server.pid') } diff --git a/spec/lib/good_job/active_job_extensions/concurrency_spec.rb b/spec/lib/good_job/active_job_extensions/concurrency_spec.rb index f64dc3fdb..57e30f8e7 100644 --- a/spec/lib/good_job/active_job_extensions/concurrency_spec.rb +++ b/spec/lib/good_job/active_job_extensions/concurrency_spec.rb @@ -39,7 +39,7 @@ def perform(name:) end describe '.good_job_control_concurrency_with' do - describe 'total_limit:', skip_rails_5: true do + describe 'total_limit:', :skip_rails_5 do before do TestJob.good_job_control_concurrency_with( total_limit: -> { 1 }, @@ -61,7 +61,7 @@ def perform(name:) end end - describe 'enqueue_limit:', skip_rails_5: true do + describe 'enqueue_limit:', :skip_rails_5 do before do TestJob.good_job_control_concurrency_with( enqueue_limit: -> { 2 }, diff --git a/spec/lib/good_job/daemon_spec.rb b/spec/lib/good_job/daemon_spec.rb index d9d6320b6..ad6ea325d 100644 --- a/spec/lib/good_job/daemon_spec.rb +++ b/spec/lib/good_job/daemon_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe GoodJob::Daemon, skip_if_java: true do +RSpec.describe GoodJob::Daemon, :skip_if_java do let(:pidfile) { Rails.application.root.join('tmp/pidfile.pid') } let(:daemon) { described_class.new(pidfile: pidfile) } diff --git a/spec/lib/good_job/scheduler_spec.rb b/spec/lib/good_job/scheduler_spec.rb index faac0302c..db14453a9 100644 --- a/spec/lib/good_job/scheduler_spec.rb +++ b/spec/lib/good_job/scheduler_spec.rb @@ -182,7 +182,7 @@ describe '#create_thread' do # The JRuby version of the ThreadPoolExecutor sometimes does not immediately # create a thread, which causes this test to flake on JRuby. - it 'returns false if there are no threads available', skip_if_java: true do + it 'returns false if there are no threads available', :skip_if_java do configuration = GoodJob::Configuration.new({ queues: 'mice:1' }) scheduler = described_class.from_configuration(configuration) diff --git a/spec/lib/good_job/systemd_service_spec.rb b/spec/lib/good_job/systemd_service_spec.rb index af2cb8697..3bf63e514 100644 --- a/spec/lib/good_job/systemd_service_spec.rb +++ b/spec/lib/good_job/systemd_service_spec.rb @@ -28,7 +28,7 @@ def read(maxlen = 16) # These are skipped on JRuby because it appears to have some issues with binding # to UNIX domain sockets, which all these tests rely on. -RSpec.describe GoodJob::SystemdService, skip_if_java: true do +RSpec.describe GoodJob::SystemdService, :skip_if_java do let(:systemd_socket) { TestSocket.new } before do diff --git a/spec/support/reset_good_job.rb b/spec/support/reset_good_job.rb index 2ce215c07..50bc5431e 100644 --- a/spec/support/reset_good_job.rb +++ b/spec/support/reset_good_job.rb @@ -61,12 +61,12 @@ if other_locks.any? puts "There are #{other_locks.count} advisory locks still open." puts "\n\nAdvisory Locks:" - other_locks.includes(:pg_stat_activity).each do |pg_lock| + other_locks.includes(:pg_stat_activity).find_each do |pg_lock| puts " - #{pg_lock.pid}: #{pg_lock.pg_stat_activity.application_name}" end puts "\n\nCurrent connections:" - PgStatActivity.all.each do |pg_stat_activity| + PgStatActivity.find_each do |pg_stat_activity| puts " - #{pg_stat_activity.pid}: #{pg_stat_activity.application_name}" end end diff --git a/spec/support/system.rb b/spec/support/system.rb index 667c115dd..ae4b36ce7 100644 --- a/spec/support/system.rb +++ b/spec/support/system.rb @@ -38,7 +38,7 @@ module SystemTestHelpers end end - config.before(:each, js: true, type: :system) do + config.before(:each, :js, type: :system) do # Chrome's no-sandbox option is required for running in Docker driven_by :selenium, using: (ENV['SHOW_BROWSER'] ? :chrome : :headless_chrome), screen_size: [1024, 800] do |driver_options| driver_options.add_argument("--disable-dev-shm-usage") diff --git a/spec/system/i18n_spec.rb b/spec/system/i18n_spec.rb index 7c7c88e5c..fcb222dfa 100644 --- a/spec/system/i18n_spec.rb +++ b/spec/system/i18n_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'I18n Internationalization', js: true do +describe 'I18n Internationalization', :js do describe "when changing language" do it "changes wording from English to Spanish" do visit good_job_path(locale: :en) diff --git a/spec/system/jobs_spec.rb b/spec/system/jobs_spec.rb index e57448b65..771db6574 100644 --- a/spec/system/jobs_spec.rb +++ b/spec/system/jobs_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Jobs', js: true do +describe 'Jobs', :js do before do allow(GoodJob).to receive_messages(retry_on_unhandled_error: false, preserve_job_records: true) end diff --git a/spec/system/live_poll_spec.rb b/spec/system/live_poll_spec.rb index 2d6de5691..3441fade3 100644 --- a/spec/system/live_poll_spec.rb +++ b/spec/system/live_poll_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Live Poll', js: true do +describe 'Live Poll', :js do before do allow(GoodJob).to receive_messages(retry_on_unhandled_error: false, preserve_job_records: true) end diff --git a/spec/system/theme_spec.rb b/spec/system/theme_spec.rb index d812a1659..47bfdb69e 100644 --- a/spec/system/theme_spec.rb +++ b/spec/system/theme_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Light and Dark Themes', js: true do +describe 'Light and Dark Themes', :js do specify do visit good_job.jobs_path expect(page).to have_css('html[data-bs-theme="light"]') diff --git a/spec/test_app/config/application.rb b/spec/test_app/config/application.rb index 1b4ef5234..d194dcdac 100644 --- a/spec/test_app/config/application.rb +++ b/spec/test_app/config/application.rb @@ -24,6 +24,8 @@ class Application < Rails::Application config.action_controller.include_all_helpers = false + config.skylight.environments << 'demo' if defined?(Skylight) + # Set default locale to something not yet translated for GoodJob # config.i18n.available_locales = [:pt] # config.i18n.default_locale = :pt