From 3f0755005abd9ab563a1e7a39dbdf07720647544 Mon Sep 17 00:00:00 2001 From: "Ben Sheldon [he/him]" Date: Wed, 27 Apr 2022 06:33:56 -0700 Subject: [PATCH] Update development dependencies --- Gemfile.lock | 166 +++++++++--------- gemfiles/rails_5.2.gemfile | 3 + gemfiles/rails_6.0.gemfile | 3 + gemfiles/rails_6.1.gemfile | 3 + gemfiles/rails_7.0.gemfile | 3 + lib/good_job/configuration.rb | 2 +- .../queue_adapters/good_job_adapter_spec.rb | 6 +- .../active_job_extensions/concurrency_spec.rb | 6 +- spec/lib/good_job/adapter_spec.rb | 18 +- spec/lib/good_job/cleanup_tracker_spec.rb | 6 +- spec/lib/good_job/current_thread_spec.rb | 2 +- spec/lib/good_job/execution_spec.rb | 24 +-- spec/lib/good_job/job_performer_spec.rb | 8 +- spec/lib/good_job/lockable_spec.rb | 24 +-- spec/lib/good_job/multi_scheduler_spec.rb | 8 +- spec/lib/good_job/notifier_spec.rb | 2 +- spec/lib/good_job/scheduler_spec.rb | 6 +- spec/lib/good_job_spec.rb | 4 +- 18 files changed, 153 insertions(+), 141 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8990d45a1..9dd71c057 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -24,52 +24,52 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.1.4.6) - actionpack (= 6.1.4.6) - activesupport (= 6.1.4.6) + actioncable (6.1.5.1) + actionpack (= 6.1.5.1) + activesupport (= 6.1.5.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.4.6) - actionpack (= 6.1.4.6) - activejob (= 6.1.4.6) - activerecord (= 6.1.4.6) - activestorage (= 6.1.4.6) - activesupport (= 6.1.4.6) + actionmailbox (6.1.5.1) + actionpack (= 6.1.5.1) + activejob (= 6.1.5.1) + activerecord (= 6.1.5.1) + activestorage (= 6.1.5.1) + activesupport (= 6.1.5.1) mail (>= 2.7.1) - actionmailer (6.1.4.6) - actionpack (= 6.1.4.6) - actionview (= 6.1.4.6) - activejob (= 6.1.4.6) - activesupport (= 6.1.4.6) + actionmailer (6.1.5.1) + actionpack (= 6.1.5.1) + actionview (= 6.1.5.1) + activejob (= 6.1.5.1) + activesupport (= 6.1.5.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.4.6) - actionview (= 6.1.4.6) - activesupport (= 6.1.4.6) + actionpack (6.1.5.1) + actionview (= 6.1.5.1) + activesupport (= 6.1.5.1) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4.6) - actionpack (= 6.1.4.6) - activerecord (= 6.1.4.6) - activestorage (= 6.1.4.6) - activesupport (= 6.1.4.6) + actiontext (6.1.5.1) + actionpack (= 6.1.5.1) + activerecord (= 6.1.5.1) + activestorage (= 6.1.5.1) + activesupport (= 6.1.5.1) nokogiri (>= 1.8.5) - actionview (6.1.4.6) - activesupport (= 6.1.4.6) + actionview (6.1.5.1) + activesupport (= 6.1.5.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4.6) - activesupport (= 6.1.4.6) + activejob (6.1.5.1) + activesupport (= 6.1.5.1) globalid (>= 0.3.6) - activemodel (6.1.4.6) - activesupport (= 6.1.4.6) - activerecord (6.1.4.6) - activemodel (= 6.1.4.6) - activesupport (= 6.1.4.6) + activemodel (6.1.5.1) + activesupport (= 6.1.5.1) + activerecord (6.1.5.1) + activemodel (= 6.1.5.1) + activesupport (= 6.1.5.1) activerecord-explain-analyze (0.1.0) activerecord (>= 4) pg @@ -78,14 +78,14 @@ GEM activerecord-jdbcpostgresql-adapter (61.1-java) activerecord-jdbc-adapter (= 61.1) jdbc-postgres (>= 9.4, < 43) - activestorage (6.1.4.6) - actionpack (= 6.1.4.6) - activejob (= 6.1.4.6) - activerecord (= 6.1.4.6) - activesupport (= 6.1.4.6) - marcel (~> 1.0.0) + activestorage (6.1.5.1) + actionpack (= 6.1.5.1) + activejob (= 6.1.5.1) + activerecord (= 6.1.5.1) + activesupport (= 6.1.5.1) + marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.4.6) + activesupport (6.1.5.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -108,11 +108,11 @@ GEM async-http-faraday (0.11.0) async-http (~> 0.42) faraday - async-io (1.32.2) + async-io (1.33.0) async async-pool (0.3.9) async (>= 1.25) - benchmark-ips (2.9.3) + benchmark-ips (2.10.0) better_html (1.0.16) actionview (>= 4.0) activesupport (>= 4.0) @@ -131,12 +131,12 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - chef-utils (17.9.46) + chef-utils (17.10.0) concurrent-ruby childprocess (3.0.0) coderay (1.1.3) concurrent-ruby (1.1.10) - console (1.14.0) + console (1.15.0) fiber-local crass (1.0.6) database_cleaner (2.0.1) @@ -159,9 +159,9 @@ GEM rubocop smart_properties erubi (1.10.0) - et-orbi (1.2.6) + et-orbi (1.2.7) tzinfo - faraday (1.9.3) + faraday (1.10.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -190,8 +190,8 @@ GEM ffi (1.15.5-java) fiber-local (1.0.0) foreman (0.87.2) - fugit (1.5.2) - et-orbi (~> 1.1, >= 1.1.8) + fugit (1.5.3) + et-orbi (~> 1, >= 1.2.7) raabro (~> 1.4) gem-release (2.2.2) github_changelog_generator (1.16.4) @@ -221,7 +221,7 @@ GEM rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) jdbc-postgres (42.2.25) - kramdown (2.3.1) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) @@ -245,9 +245,9 @@ GEM mixlib-cli (2.1.8) mixlib-config (3.0.9) tomlrb - mixlib-shellout (3.2.5) + mixlib-shellout (3.2.7) chef-utils - msgpack (1.4.4) + msgpack (1.5.1) multi_json (1.15.0) multipart-post (2.1.1) nio4r (2.5.8) @@ -261,10 +261,10 @@ GEM faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) optimist (3.0.1) - parallel (1.21.0) - parser (3.1.1.0) + parallel (1.22.1) + parser (3.1.2.0) ast (~> 2.4.1) - pg (1.3.1) + pg (1.3.5) protocol-hpack (1.4.2) protocol-http (0.22.5) protocol-http1 (0.14.2) @@ -284,10 +284,10 @@ GEM pry (~> 0.13.0) pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (4.0.6) - puma (5.6.2) + public_suffix (4.0.7) + puma (5.6.4) nio4r (~> 2.0) - puma (5.6.2-java) + puma (5.6.4-java) nio4r (~> 2.0) raabro (1.4.0) racc (1.6.0) @@ -295,20 +295,20 @@ GEM rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.1.4.6) - actioncable (= 6.1.4.6) - actionmailbox (= 6.1.4.6) - actionmailer (= 6.1.4.6) - actionpack (= 6.1.4.6) - actiontext (= 6.1.4.6) - actionview (= 6.1.4.6) - activejob (= 6.1.4.6) - activemodel (= 6.1.4.6) - activerecord (= 6.1.4.6) - activestorage (= 6.1.4.6) - activesupport (= 6.1.4.6) + rails (6.1.5.1) + actioncable (= 6.1.5.1) + actionmailbox (= 6.1.5.1) + actionmailer (= 6.1.5.1) + actionpack (= 6.1.5.1) + actiontext (= 6.1.5.1) + actionview (= 6.1.5.1) + activejob (= 6.1.5.1) + activemodel (= 6.1.5.1) + activerecord (= 6.1.5.1) + activestorage (= 6.1.5.1) + activesupport (= 6.1.5.1) bundler (>= 1.15.0) - railties (= 6.1.4.6) + railties (= 6.1.5.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -318,11 +318,11 @@ GEM rails-i18n (7.0.3) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (6.1.4.6) - actionpack (= 6.1.4.6) - activesupport (= 6.1.4.6) + railties (6.1.5.1) + actionpack (= 6.1.5.1) + activesupport (= 6.1.5.1) method_source - rake (>= 0.13) + rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) rake (13.0.6) @@ -330,17 +330,17 @@ GEM ffi (>= 1.0.6) msgpack (>= 0.4.3) optimist (>= 3.0.0) - regexp_parser (2.2.1) + regexp_parser (2.3.1) rexml (3.2.5) rspec-core (3.11.0) rspec-support (~> 3.11.0) rspec-expectations (3.11.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.11.0) - rspec-mocks (3.11.0) + rspec-mocks (3.11.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.11.0) - rspec-rails (5.1.0) + rspec-rails (5.1.2) actionpack (>= 5.2) activesupport (>= 5.2) railties (>= 5.2) @@ -349,25 +349,25 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.11.0) - rubocop (1.25.1) + rubocop (1.28.2) parallel (~> 1.10) parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.15.1, < 2.0) + rubocop-ast (>= 1.17.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.15.1) - parser (>= 3.0.1.1) - rubocop-performance (1.13.2) + rubocop-ast (1.17.0) + parser (>= 3.1.1.0) + rubocop-performance (1.13.3) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.13.2) + rubocop-rails (2.14.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) - rubocop-rspec (2.8.0) + rubocop-rspec (2.10.0) rubocop (~> 1.19) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) @@ -382,7 +382,7 @@ GEM smart_properties (1.17.0) spoon (0.0.6) ffi - sprockets (4.0.2) + sprockets (4.0.3) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.4.2) diff --git a/gemfiles/rails_5.2.gemfile b/gemfiles/rails_5.2.gemfile index 255ba4ccb..5ab936c8e 100644 --- a/gemfiles/rails_5.2.gemfile +++ b/gemfiles/rails_5.2.gemfile @@ -4,6 +4,7 @@ source "https://rubygems.org" gem "activerecord-jdbcpostgresql-adapter", platforms: [:jruby] gem "appraisal", branch: "fix-bundle-env", git: "https://github.com/bensheldon/appraisal.git" +gem "nokogiri", "~> 1.12.0" gem "pg", platforms: [:mri, :mingw, :x64_mingw] gem "rails", "~> 5.2.0" @@ -14,7 +15,9 @@ platforms :ruby do gem "rbtrace" group :lint do + gem "easy_translate" gem "erb_lint", ">= 0.0.35" + gem "i18n-tasks" gem "mdl" gem "rubocop" gem "rubocop-performance" diff --git a/gemfiles/rails_6.0.gemfile b/gemfiles/rails_6.0.gemfile index 038002f53..ce8bf09ec 100644 --- a/gemfiles/rails_6.0.gemfile +++ b/gemfiles/rails_6.0.gemfile @@ -4,6 +4,7 @@ source "https://rubygems.org" gem "activerecord-jdbcpostgresql-adapter", platforms: [:jruby] gem "appraisal", branch: "fix-bundle-env", git: "https://github.com/bensheldon/appraisal.git" +gem "nokogiri", "~> 1.12.0" gem "pg", platforms: [:mri, :mingw, :x64_mingw] gem "rails", "~> 6.0.0" @@ -14,7 +15,9 @@ platforms :ruby do gem "rbtrace" group :lint do + gem "easy_translate" gem "erb_lint", ">= 0.0.35" + gem "i18n-tasks" gem "mdl" gem "rubocop" gem "rubocop-performance" diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile index d97519601..ec81a799b 100644 --- a/gemfiles/rails_6.1.gemfile +++ b/gemfiles/rails_6.1.gemfile @@ -4,6 +4,7 @@ source "https://rubygems.org" gem "activerecord-jdbcpostgresql-adapter", platforms: [:jruby] gem "appraisal", branch: "fix-bundle-env", git: "https://github.com/bensheldon/appraisal.git" +gem "nokogiri", "~> 1.12.0" gem "pg", platforms: [:mri, :mingw, :x64_mingw] gem "rails", "~> 6.1.0" @@ -14,7 +15,9 @@ platforms :ruby do gem "rbtrace" group :lint do + gem "easy_translate" gem "erb_lint", ">= 0.0.35" + gem "i18n-tasks" gem "mdl" gem "rubocop" gem "rubocop-performance" diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index b371256a2..cd8b0d43e 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -4,6 +4,7 @@ source "https://rubygems.org" gem "activerecord-jdbcpostgresql-adapter", platforms: [:jruby] gem "appraisal", branch: "fix-bundle-env", git: "https://github.com/bensheldon/appraisal.git" +gem "nokogiri", "~> 1.12.0" gem "pg", platforms: [:mri, :mingw, :x64_mingw] gem "rails", "~> 7.0.0" gem "selenium-webdriver", "~> 4.0" @@ -15,7 +16,9 @@ platforms :ruby do gem "rbtrace" group :lint do + gem "easy_translate" gem "erb_lint", ">= 0.0.35" + gem "i18n-tasks" gem "mdl" gem "rubocop" gem "rubocop-performance" diff --git a/lib/good_job/configuration.rb b/lib/good_job/configuration.rb index 0ab5d46e8..31d7103fc 100644 --- a/lib/good_job/configuration.rb +++ b/lib/good_job/configuration.rb @@ -159,7 +159,7 @@ def enable_cron alias enable_cron? enable_cron def cron - env_cron = JSON.parse(ENV['GOOD_JOB_CRON'], symbolize_names: true) if ENV['GOOD_JOB_CRON'].present? + env_cron = JSON.parse(ENV.fetch('GOOD_JOB_CRON'), symbolize_names: true) if ENV['GOOD_JOB_CRON'].present? options[:cron] || rails_config[:cron] || diff --git a/spec/lib/active_job/queue_adapters/good_job_adapter_spec.rb b/spec/lib/active_job/queue_adapters/good_job_adapter_spec.rb index 80196b5ab..127aabc2f 100644 --- a/spec/lib/active_job/queue_adapters/good_job_adapter_spec.rb +++ b/spec/lib/active_job/queue_adapters/good_job_adapter_spec.rb @@ -22,7 +22,7 @@ it 'runs async' do adapter = described_class.new - expect(adapter.execute_async?).to eq true + expect(adapter.execute_async?).to be true end end @@ -31,7 +31,7 @@ it 'runs inline' do adapter = described_class.new - expect(adapter.execute_inline?).to eq true + expect(adapter.execute_inline?).to be true end end @@ -40,7 +40,7 @@ it 'runs in normal mode' do adapter = described_class.new - expect(adapter.execute_inline?).to eq false + expect(adapter.execute_inline?).to be false end end end 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 99173b9ce..43cdba652 100644 --- a/spec/lib/good_job/active_job_extensions/concurrency_spec.rb +++ b/spec/lib/good_job/active_job_extensions/concurrency_spec.rb @@ -25,14 +25,14 @@ def perform(name:) it "does not enqueue if limit is exceeded for a particular key" do expect(TestJob.perform_later(name: "Alice")).to be_present - expect(TestJob.perform_later(name: "Alice")).to eq false + expect(TestJob.perform_later(name: "Alice")).to be false end it "is inclusive of both performing and enqueued jobs" do expect(TestJob.perform_later(name: "Alice")).to be_present GoodJob::Execution.all.with_advisory_lock do - expect(TestJob.perform_later(name: "Alice")).to eq false + expect(TestJob.perform_later(name: "Alice")).to be false end end end @@ -50,7 +50,7 @@ def perform(name:) expect(TestJob.perform_later(name: "Alice")).to be_present # Third usage of key does not enqueue - expect(TestJob.perform_later(name: "Alice")).to eq false + expect(TestJob.perform_later(name: "Alice")).to be false # Usage of different key does enqueue expect(TestJob.perform_later(name: "Bob")).to be_present diff --git a/spec/lib/good_job/adapter_spec.rb b/spec/lib/good_job/adapter_spec.rb index 7167e00cc..7a6d93e08 100644 --- a/spec/lib/good_job/adapter_spec.rb +++ b/spec/lib/good_job/adapter_spec.rb @@ -98,7 +98,7 @@ def perform(succeed: true) let(:adapter) { described_class.new(execution_mode: :async_all) } it 'returns true' do - expect(adapter.execute_async?).to eq true + expect(adapter.execute_async?).to be true end end @@ -111,8 +111,8 @@ def perform(succeed: true) end it 'returns true' do - expect(adapter.execute_async?).to eq true - expect(adapter.execute_externally?).to eq false + expect(adapter.execute_async?).to be true + expect(adapter.execute_externally?).to be false end end @@ -122,8 +122,8 @@ def perform(succeed: true) end it 'returns false' do - expect(adapter.execute_async?).to eq false - expect(adapter.execute_externally?).to eq true + expect(adapter.execute_async?).to be false + expect(adapter.execute_externally?).to be true end end end @@ -137,8 +137,8 @@ def perform(succeed: true) end it 'returns true' do - expect(adapter.execute_async?).to eq true - expect(adapter.execute_externally?).to eq false + expect(adapter.execute_async?).to be true + expect(adapter.execute_externally?).to be false end end @@ -148,8 +148,8 @@ def perform(succeed: true) end it 'returns false' do - expect(adapter.execute_async?).to eq false - expect(adapter.execute_externally?).to eq true + expect(adapter.execute_async?).to be false + expect(adapter.execute_externally?).to be true end end end diff --git a/spec/lib/good_job/cleanup_tracker_spec.rb b/spec/lib/good_job/cleanup_tracker_spec.rb index 4ec812e0b..51ca496cc 100644 --- a/spec/lib/good_job/cleanup_tracker_spec.rb +++ b/spec/lib/good_job/cleanup_tracker_spec.rb @@ -9,7 +9,7 @@ 1000.times { tracker.increment } travel_to 1.year.from_now do - expect(tracker.cleanup?).to eq false + expect(tracker.cleanup?).to be false end end end @@ -18,10 +18,10 @@ tracker = described_class.new(cleanup_interval_seconds: nil, cleanup_interval_jobs: 10) 10.times { tracker.increment } - expect(tracker.cleanup?).to eq false + expect(tracker.cleanup?).to be false tracker.increment - expect(tracker.cleanup?).to eq true + expect(tracker.cleanup?).to be true end end diff --git a/spec/lib/good_job/current_thread_spec.rb b/spec/lib/good_job/current_thread_spec.rb index 68b3bd74a..1cc905243 100644 --- a/spec/lib/good_job/current_thread_spec.rb +++ b/spec/lib/good_job/current_thread_spec.rb @@ -33,7 +33,7 @@ it 'is resettable' do described_class.send "#{accessor}=", 'apple' described_class.reset - expect(described_class.send(accessor)).to eq nil + expect(described_class.send(accessor)).to be_nil end end end diff --git a/spec/lib/good_job/execution_spec.rb b/spec/lib/good_job/execution_spec.rb index 9952fc03f..d3a6306c7 100644 --- a/spec/lib/good_job/execution_spec.rb +++ b/spec/lib/good_job/execution_spec.rb @@ -46,10 +46,10 @@ def perform(result_value = nil, raise_error: false) it 'can be created with an advisory lock' do unlocked_execution = described_class.enqueue(active_job) - expect(unlocked_execution.advisory_locked?).to eq false + expect(unlocked_execution.advisory_locked?).to be false locked_execution = described_class.enqueue(active_job, create_with_advisory_lock: true) - expect(locked_execution.advisory_locked?).to eq true + expect(locked_execution.advisory_locked?).to be true locked_execution.advisory_unlock end @@ -73,13 +73,13 @@ def perform(result_value = nil, raise_error: false) expect(result).to be_a GoodJob::ExecutionResult expect(result.value).to eq 'a string' - expect(result.unhandled_error).to eq nil + expect(result.unhandled_error).to be_nil described_class.enqueue(TestJob.new(true, raise_error: true)) errored_result = described_class.all.perform_with_advisory_lock expect(result).to be_a GoodJob::ExecutionResult - expect(errored_result.value).to eq nil + expect(errored_result.value).to be_nil expect(errored_result.unhandled_error).to be_an TestJob::ExpectedError end end @@ -184,21 +184,21 @@ def perform(result_value = nil, raise_error: false) it 'is true when locked' do good_job.with_advisory_lock do - expect(good_job.executable?).to eq true + expect(good_job.executable?).to be true end end it 'is false when job no longer exists' do good_job.with_advisory_lock do good_job.destroy! - expect(good_job.executable?).to eq false + expect(good_job.executable?).to be false end end it 'is false when the job has finished' do good_job.with_advisory_lock do good_job.update! finished_at: Time.current - expect(good_job.executable?).to eq false + expect(good_job.executable?).to be false end end end @@ -227,7 +227,7 @@ def perform(result_value = nil, raise_error: false) it 'returns the error' do result = good_job.perform - expect(result.value).to eq nil + expect(result.value).to be_nil expect(result.unhandled_error).to be_an_instance_of TestJob::ExpectedError end @@ -283,7 +283,7 @@ def perform(result_value = nil, raise_error: false) it 'returns the error' do result = good_job.perform - expect(result.value).to eq nil + expect(result.value).to be_nil expect(result.unhandled_error).to be_an_instance_of TestJob::ExpectedError end @@ -297,7 +297,7 @@ def perform(result_value = nil, raise_error: false) it 'returns the error' do result = good_job.perform - expect(result.value).to eq nil + expect(result.value).to be_nil expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError end end @@ -310,7 +310,7 @@ def perform(result_value = nil, raise_error: false) it 'returns the error' do result = good_job.perform - expect(result.value).to eq nil + expect(result.value).to be_nil expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError end end @@ -384,7 +384,7 @@ def perform(result_value = nil, raise_error: false) it 'returns the results of the job' do result = good_job.perform - expect(result.value).to eq nil + expect(result.value).to be_nil expect(result.unhandled_error).to be_a(TestJob::ExpectedError) end diff --git a/spec/lib/good_job/job_performer_spec.rb b/spec/lib/good_job/job_performer_spec.rb index 3a8778e25..409b636b3 100644 --- a/spec/lib/good_job/job_performer_spec.rb +++ b/spec/lib/good_job/job_performer_spec.rb @@ -26,16 +26,16 @@ state = { queue_name: 'elephants' } result = described_class.new('*').next?(state) - expect(result).to eq true + expect(result).to be true result = described_class.new('elephants').next?(state) - expect(result).to eq true + expect(result).to be true result = described_class.new('-elephants').next?(state) - expect(result).to eq false + expect(result).to be false result = described_class.new('mice').next?(state) - expect(result).to eq false + expect(result).to be false end end diff --git a/spec/lib/good_job/lockable_spec.rb b/spec/lib/good_job/lockable_spec.rb index 2ee7fd56c..2265c3113 100644 --- a/spec/lib/good_job/lockable_spec.rb +++ b/spec/lib/good_job/lockable_spec.rb @@ -112,7 +112,7 @@ model_class.advisory_lock_key(execution.lockable_key) do promise = Concurrent::Promises.future do result = model_class.advisory_lock_key(execution.lockable_key) { raise } - expect(result).to eq nil + expect(result).to be_nil end expect { promise.value! }.not_to raise_error end @@ -178,9 +178,9 @@ end it 'returns true or false if the lock is acquired' do - expect(execution.advisory_lock).to eq true + expect(execution.advisory_lock).to be true - expect(Concurrent::Promises.future(execution, &:advisory_lock).value!).to eq false + expect(Concurrent::Promises.future(execution, &:advisory_lock).value!).to be false execution.advisory_unlock end @@ -232,8 +232,8 @@ it 'returns true or false if the unlock operation is successful' do execution.advisory_lock - expect(Concurrent::Promises.future(execution, &:advisory_unlock).value!).to eq false - expect(execution.advisory_unlock).to eq true + expect(Concurrent::Promises.future(execution, &:advisory_unlock).value!).to be false + expect(execution.advisory_unlock).to be true unless RUBY_PLATFORM.include?('java') expect(POSTGRES_NOTICES.first).to include "you don't own a lock of type ExclusiveLock" @@ -244,20 +244,20 @@ describe '#advisory_locked?' do it 'reflects whether the record is locked' do - expect(execution.advisory_locked?).to eq false + expect(execution.advisory_locked?).to be false execution.advisory_lock - expect(execution.advisory_locked?).to eq true + expect(execution.advisory_locked?).to be true execution.advisory_unlock - expect(execution.advisory_locked?).to eq false + expect(execution.advisory_locked?).to be false end it 'is accurate even if the execution has been destroyed' do execution.advisory_lock - expect(execution.advisory_locked?).to eq true + expect(execution.advisory_locked?).to be true execution.destroy! - expect(execution.advisory_locked?).to eq true + expect(execution.advisory_locked?).to be true execution.advisory_unlock - expect(execution.advisory_locked?).to eq false + expect(execution.advisory_locked?).to be false end end @@ -278,7 +278,7 @@ model_class.advisory_unlock_session - expect(execution.advisory_locked?).to eq false + expect(execution.advisory_locked?).to be false end end diff --git a/spec/lib/good_job/multi_scheduler_spec.rb b/spec/lib/good_job/multi_scheduler_spec.rb index b0da2816c..3fa4ffbec 100644 --- a/spec/lib/good_job/multi_scheduler_spec.rb +++ b/spec/lib/good_job/multi_scheduler_spec.rb @@ -15,7 +15,7 @@ allow(scheduler_2).to receive(:create_thread).and_return(false) result = multi_scheduler.create_thread(state) - expect(result).to eq true + expect(result).to be true expect(scheduler_1).to have_received(:create_thread) expect(scheduler_2).to have_received(:create_thread) @@ -27,7 +27,7 @@ it 'delegates to all schedulers if they return nil' do result = multi_scheduler.create_thread(state) - expect(result).to eq nil + expect(result).to be_nil expect(scheduler_1).to have_received(:create_thread).with(state) expect(scheduler_2).to have_received(:create_thread).with(state) @@ -38,7 +38,7 @@ allow(scheduler_2).to receive(:create_thread).and_return(false) result = multi_scheduler.create_thread(state) - expect(result).to eq false + expect(result).to be false expect(scheduler_1).to have_received(:create_thread) expect(scheduler_2).to have_received(:create_thread) @@ -49,7 +49,7 @@ allow(scheduler_2).to receive(:create_thread).and_return(false) result = multi_scheduler.create_thread(state) - expect(result).to eq true + expect(result).to be true expect(scheduler_1).to have_received(:create_thread) expect(scheduler_2).not_to have_received(:create_thread) diff --git a/spec/lib/good_job/notifier_spec.rb b/spec/lib/good_job/notifier_spec.rb index ce4b1cf12..42d65855e 100644 --- a/spec/lib/good_job/notifier_spec.rb +++ b/spec/lib/good_job/notifier_spec.rb @@ -31,7 +31,7 @@ sleep_until(max: 5, increments_of: 0.5) { RECEIVED_MESSAGE.true? } notifier.shutdown - expect(RECEIVED_MESSAGE.true?).to eq true + expect(RECEIVED_MESSAGE.true?).to be true end it 'raises exception to GoodJob.on_thread_error' do diff --git a/spec/lib/good_job/scheduler_spec.rb b/spec/lib/good_job/scheduler_spec.rb index afe5542dd..fff55d136 100644 --- a/spec/lib/good_job/scheduler_spec.rb +++ b/spec/lib/good_job/scheduler_spec.rb @@ -103,21 +103,21 @@ scheduler = described_class.from_configuration(configuration) scheduler.create_thread(queue_name: 'mice') - expect(scheduler.create_thread(queue_name: 'mice')).to eq nil + expect(scheduler.create_thread(queue_name: 'mice')).to be_nil end it 'returns true if the state matches the performer' do configuration = GoodJob::Configuration.new({ queues: 'mice:2' }) scheduler = described_class.from_configuration(configuration) - expect(scheduler.create_thread(queue_name: 'mice')).to eq true + expect(scheduler.create_thread(queue_name: 'mice')).to be true end it 'returns false if the state does not match the performer' do configuration = GoodJob::Configuration.new({ queues: 'mice:2' }) scheduler = described_class.from_configuration(configuration) - expect(scheduler.create_thread(queue_name: 'elephant')).to eq false + expect(scheduler.create_thread(queue_name: 'elephant')).to be false end end diff --git a/spec/lib/good_job_spec.rb b/spec/lib/good_job_spec.rb index 8ace32e4e..7671ad235 100644 --- a/spec/lib/good_job_spec.rb +++ b/spec/lib/good_job_spec.rb @@ -10,8 +10,8 @@ it 'shuts down all scheduler and notifier instances' do described_class.shutdown - expect(scheduler.shutdown?).to eq true - expect(notifier.shutdown?).to eq true + expect(scheduler.shutdown?).to be true + expect(notifier.shutdown?).to be true end end