From a52387d2e44f3401bf409179ea6511d2c8f77cf0 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 12:59:48 +0530 Subject: [PATCH 01/18] Update required ruby version --- .rubocop.yml | 2 +- imdb_title.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index dd7f0e2..9bcebbb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,7 +7,7 @@ # # Any of these may be changed. AllCops: - TargetRubyVersion: "3.2.2" + TargetRubyVersion: "3.0.0" StringLiterals: Enabled: false diff --git a/imdb_title.gemspec b/imdb_title.gemspec index 9617b74..50601cd 100644 --- a/imdb_title.gemspec +++ b/imdb_title.gemspec @@ -21,5 +21,5 @@ Gem::Specification.new do |s| } s.add_runtime_dependency "httparty", "~> 0.21.0" s.add_runtime_dependency "nokogiri", "~> 1.15", ">= 1.15.4" - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.0.0" end From f605aafd3d5b6c1e96f643ae1667a216e5295b77 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 13:02:28 +0530 Subject: [PATCH 02/18] Enable new cops --- .rubocop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.rubocop.yml b/.rubocop.yml index 9bcebbb..91d5cf4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,6 +8,7 @@ # Any of these may be changed. AllCops: TargetRubyVersion: "3.0.0" + NewCops: enable StringLiterals: Enabled: false From 46ff457cf1979095605e1f875bf364b46047d8c6 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 13:03:06 +0530 Subject: [PATCH 03/18] exclude linting offenses from `test.rb` file --- .rubocop.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 91d5cf4..5b1ba64 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,6 +9,8 @@ AllCops: TargetRubyVersion: "3.0.0" NewCops: enable + Exclude: + - "test.rb" StringLiterals: Enabled: false From e381ef85eb7b3fbbf29a2d4fa23fbfa8162c750e Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 13:03:38 +0530 Subject: [PATCH 04/18] FIX `Gemspec/RequireMFA` offense --- imdb_title.gemspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imdb_title.gemspec b/imdb_title.gemspec index 50601cd..8384c46 100644 --- a/imdb_title.gemspec +++ b/imdb_title.gemspec @@ -17,7 +17,8 @@ Gem::Specification.new do |s| s.metadata = { "source_code_uri" => "https://github.com/JuzerShakir/imdb", "changelog_uri" => "https://github.com/JuzerShakir/imdb/blob/master/CHANGELOG.md", - "bug_tracker_uri" => "https://github.com/JuzerShakir/imdb/issues" + "bug_tracker_uri" => "https://github.com/JuzerShakir/imdb/issues", + 'rubygems_mfa_required' => 'true' } s.add_runtime_dependency "httparty", "~> 0.21.0" s.add_runtime_dependency "nokogiri", "~> 1.15", ">= 1.15.4" From f86b946e8dc272aef164e719f44093f3df5259db Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 13:04:51 +0530 Subject: [PATCH 05/18] FIX `Lint/RedundantDirGlobSort` offense --- lib/helper.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/helper.rb b/lib/helper.rb index 2a61001..daf27dc 100644 --- a/lib/helper.rb +++ b/lib/helper.rb @@ -5,5 +5,4 @@ require "httparty" # load all files & folders of the current directory 'lib' -lib = __dir__ -Dir.glob(File.join(lib, "**", "*.rb")).sort.each(&method(:require)) +Dir.glob(File.join(__dir__, "**", "*.rb")).each(&method(:require)) From ebb33d9e5520d0dc2cee640515604df5474beb8c Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 16:10:28 +0530 Subject: [PATCH 06/18] Add `rubocop-minitest` gem --- Gemfile | 1 + Gemfile.lock | 75 +++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/Gemfile b/Gemfile index a63dc16..1ff3edc 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,7 @@ gem "minitest-hooks", "~> 1.5", ">= 1.5.2" gem "rake", "~> 13.0", ">= 13.0.6" gem "reek", "~> 6.1", ">= 6.1.4" gem "require_all", "~> 3.0" +gem 'rubocop-minitest', '~> 0.36.0' gem "standard", "~> 1.31", ">= 1.31.1" gem "vcr", "~> 6.3", ">= 6.3.1" gem "webmock", "~> 3.24" diff --git a/Gemfile.lock b/Gemfile.lock index a99ab03..de3e2d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,6 +13,7 @@ GEM ast (2.4.2) base64 (0.1.1) bigdecimal (3.1.9) + concurrent-ruby (1.3.4) crack (1.0.0) bigdecimal rexml @@ -20,6 +21,34 @@ GEM debug (1.10.0) irb (~> 1.10) reline (>= 0.3.8) + dry-configurable (1.2.0) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-core (1.0.2) + concurrent-ruby (~> 1.0) + logger + zeitwerk (~> 2.6) + dry-inflector (1.1.0) + dry-initializer (3.1.1) + dry-logic (1.5.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-schema (1.13.4) + concurrent-ruby (~> 1.0) + dry-configurable (~> 1.0, >= 1.0.1) + dry-core (~> 1.0, < 2) + dry-initializer (~> 3.0) + dry-logic (>= 1.4, < 2) + dry-types (>= 1.7, < 2) + zeitwerk (~> 2.6) + dry-types (1.7.2) + bigdecimal (~> 3.0) + concurrent-ruby (~> 1.0) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-logic (~> 1.4) + zeitwerk (~> 2.6) hashdiff (1.1.2) httparty (0.21.0) mini_mime (>= 1.0.0) @@ -29,9 +58,9 @@ GEM rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.6.3) - kwalify (0.7.2) language_server-protocol (3.17.0.3) lint_roller (1.1.0) + logger (1.6.4) mini_mime (1.1.5) minitest (5.20.0) minitest-hooks (1.5.2) @@ -40,7 +69,7 @@ GEM nokogiri (1.15.4-x86_64-linux) racc (~> 1.4) parallel (1.23.0) - parser (3.2.2.3) + parser (3.3.6.0) ast (~> 2.4.1) racc psych (5.2.2) @@ -52,45 +81,47 @@ GEM rake (13.0.6) rdoc (6.10.0) psych (>= 4.0.0) - reek (6.1.4) - kwalify (~> 0.7.0) - parser (~> 3.2.0) + reek (6.3.0) + dry-schema (~> 1.13.0) + parser (~> 3.3.0) rainbow (>= 2.0, < 4.0) + rexml (~> 3.1) regexp_parser (2.8.1) reline (0.6.0) io-console (~> 0.5) require_all (3.0.0) rexml (3.2.6) - rubocop (1.56.4) - base64 (~> 0.1.1) + rubocop (1.68.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - rubocop-performance (1.19.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) + rubocop-ast (1.37.0) + parser (>= 3.3.1.0) + rubocop-minitest (0.36.0) + rubocop (>= 1.61, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-performance (1.23.0) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) - standard (1.31.1) + standard (1.42.1) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.56.2) + rubocop (~> 1.68.0) standard-custom (~> 1.0.0) - standard-performance (~> 1.2) + standard-performance (~> 1.5) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) - standard-performance (1.2.0) + standard-performance (1.6.0) lint_roller (~> 1.1) - rubocop-performance (~> 1.19.0) + rubocop-performance (~> 1.23.0) stringio (3.1.2) unicode-display_width (2.4.2) vcr (6.3.1) @@ -99,6 +130,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + zeitwerk (2.7.1) PLATFORMS x86_64-linux @@ -111,6 +143,7 @@ DEPENDENCIES rake (~> 13.0, >= 13.0.6) reek (~> 6.1, >= 6.1.4) require_all (~> 3.0) + rubocop-minitest (~> 0.36.0) standard (~> 1.31, >= 1.31.1) vcr (~> 6.3, >= 6.3.1) webmock (~> 3.24) From 84667a60fc2eaa7cc43a10ca906ae5a86cdf462e Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 16:14:39 +0530 Subject: [PATCH 07/18] Check offenses for minitest --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 5b1ba64..39fa543 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,6 +12,9 @@ AllCops: Exclude: - "test.rb" +require: + - rubocop-minitest + StringLiterals: Enabled: false From b1b6c74f853e6fab9321addaa73c515ec0d96092 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 16:15:36 +0530 Subject: [PATCH 08/18] FIX `Minitest/AssertRaisesCompoundBody` offense and use vcr for wrong id --- test/exceptions_test.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/exceptions_test.rb b/test/exceptions_test.rb index 9b3c4de..d3cb4a3 100644 --- a/test/exceptions_test.rb +++ b/test/exceptions_test.rb @@ -6,9 +6,10 @@ # tests for custom exceptions class ExceptionsTest < Minitest::Test def test_invalid_url - assert_raises(IMDb::InvalidURL) do - IMDb::Title.new("http://www.example.com") - IMDb::Title.new("https://www.imdb.com/title/tt549199490/") + assert_raises(IMDb::InvalidURL) { IMDb::Title.new("http://www.example.com") } + + VCR.use_cassette("wrong_id") do + assert_raises(IMDb::InvalidURL) { IMDb::Title.new("https://www.imdb.com/title/tt549199490/") } end end end From 3d2c0120d6e53ed13f645274da40b0e9aa13450b Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 16:19:34 +0530 Subject: [PATCH 09/18] FIX `Gemspec/AddRuntimeDependency` offense --- imdb_title.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imdb_title.gemspec b/imdb_title.gemspec index 8384c46..e4ec1ad 100644 --- a/imdb_title.gemspec +++ b/imdb_title.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| "bug_tracker_uri" => "https://github.com/JuzerShakir/imdb/issues", 'rubygems_mfa_required' => 'true' } - s.add_runtime_dependency "httparty", "~> 0.21.0" - s.add_runtime_dependency "nokogiri", "~> 1.15", ">= 1.15.4" + s.add_dependency "httparty", "~> 0.21.0" + s.add_dependency "nokogiri", "~> 1.15", ">= 1.15.4" s.required_ruby_version = ">= 3.0.0" end From 13bd34e2e13840c71469af4a366554fec0b8df74 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 16:25:55 +0530 Subject: [PATCH 10/18] Add `rubocop` gem --- Gemfile | 1 + Gemfile.lock | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 1ff3edc..70d7e80 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,7 @@ gem "minitest-hooks", "~> 1.5", ">= 1.5.2" gem "rake", "~> 13.0", ">= 13.0.6" gem "reek", "~> 6.1", ">= 6.1.4" gem "require_all", "~> 3.0" +gem 'rubocop', '~> 1.69', '>= 1.69.2' gem 'rubocop-minitest', '~> 0.36.0' gem "standard", "~> 1.31", ">= 1.31.1" gem "vcr", "~> 6.3", ">= 6.3.1" diff --git a/Gemfile.lock b/Gemfile.lock index de3e2d7..d8d1aa2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -57,7 +57,7 @@ GEM irb (1.14.3) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.6.3) + json (2.9.1) language_server-protocol (3.17.0.3) lint_roller (1.1.0) logger (1.6.4) @@ -68,7 +68,7 @@ GEM multi_xml (0.6.0) nokogiri (1.15.4-x86_64-linux) racc (~> 1.4) - parallel (1.23.0) + parallel (1.26.3) parser (3.3.6.0) ast (~> 2.4.1) racc @@ -86,21 +86,21 @@ GEM parser (~> 3.3.0) rainbow (>= 2.0, < 4.0) rexml (~> 3.1) - regexp_parser (2.8.1) + regexp_parser (2.10.0) reline (0.6.0) io-console (~> 0.5) require_all (3.0.0) rexml (3.2.6) - rubocop (1.68.0) + rubocop (1.69.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) + unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.37.0) parser (>= 3.3.1.0) rubocop-minitest (0.36.0) @@ -110,12 +110,12 @@ GEM rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) - standard (1.42.1) + standard (1.43.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.68.0) + rubocop (~> 1.69.1) standard-custom (~> 1.0.0) - standard-performance (~> 1.5) + standard-performance (~> 1.6) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) @@ -123,7 +123,9 @@ GEM lint_roller (~> 1.1) rubocop-performance (~> 1.23.0) stringio (3.1.2) - unicode-display_width (2.4.2) + unicode-display_width (3.1.3) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) vcr (6.3.1) base64 webmock (3.24.0) @@ -143,6 +145,7 @@ DEPENDENCIES rake (~> 13.0, >= 13.0.6) reek (~> 6.1, >= 6.1.4) require_all (~> 3.0) + rubocop (~> 1.69, >= 1.69.2) rubocop-minitest (~> 0.36.0) standard (~> 1.31, >= 1.31.1) vcr (~> 6.3, >= 6.3.1) From a582191fc6f365a0fcfdf5f9064dd03126df6db8 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 16:26:46 +0530 Subject: [PATCH 11/18] Add `rubocop-rake` gem --- Gemfile | 1 + Gemfile.lock | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index 70d7e80..19a1174 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ gem "reek", "~> 6.1", ">= 6.1.4" gem "require_all", "~> 3.0" gem 'rubocop', '~> 1.69', '>= 1.69.2' gem 'rubocop-minitest', '~> 0.36.0' +gem 'rubocop-rake', '~> 0.6.0' gem "standard", "~> 1.31", ">= 1.31.1" gem "vcr", "~> 6.3", ">= 6.3.1" gem "webmock", "~> 3.24" diff --git a/Gemfile.lock b/Gemfile.lock index d8d1aa2..5b36af5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,6 +109,8 @@ GEM rubocop-performance (1.23.0) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rake (0.6.0) + rubocop (~> 1.0) ruby-progressbar (1.13.0) standard (1.43.0) language_server-protocol (~> 3.17.0.2) @@ -147,6 +149,7 @@ DEPENDENCIES require_all (~> 3.0) rubocop (~> 1.69, >= 1.69.2) rubocop-minitest (~> 0.36.0) + rubocop-rake (~> 0.6.0) standard (~> 1.31, >= 1.31.1) vcr (~> 6.3, >= 6.3.1) webmock (~> 3.24) From f8ea46ecb31848c514d4de13513f0f3554d00f45 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 16:30:12 +0530 Subject: [PATCH 12/18] require `rubocop-rake` --- .rubocop.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 39fa543..899cc87 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,15 +6,16 @@ # guidelines for contributions. # # Any of these may be changed. +require: + - rubocop-minitest + - rubocop-rake + AllCops: TargetRubyVersion: "3.0.0" NewCops: enable Exclude: - "test.rb" -require: - - rubocop-minitest - StringLiterals: Enabled: false From cc4b293d568129c3bc75932f5e89003663fa348a Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 17:13:39 +0530 Subject: [PATCH 13/18] Setup `standard` with rubocop --- .rubocop.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 899cc87..b8ddd6e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,18 +9,13 @@ require: - rubocop-minitest - rubocop-rake + - standard + +inherit_gem: + standard: config/base.yml AllCops: TargetRubyVersion: "3.0.0" NewCops: enable Exclude: - "test.rb" - -StringLiterals: - Enabled: false - -SpaceInsideHashLiteralBraces: - Enabled: false - -Style/ClassVars: - Enabled: false From 8e7ba7c478f113ffb65a3511b64f1dab85985761 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 17:14:40 +0530 Subject: [PATCH 14/18] FIX multiple offenses --- Gemfile | 6 +++--- imdb_title.gemspec | 2 +- test/titles/episode_test.rb | 7 ++++--- test/titles/in_development_test.rb | 5 +++-- test/titles/movie_test.rb | 6 ++++-- test/titles/tv_show_test.rb | 4 ++-- test/titles/video_game_test.rb | 5 +++-- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index 19a1174..43a3635 100644 --- a/Gemfile +++ b/Gemfile @@ -13,9 +13,9 @@ gem "minitest-hooks", "~> 1.5", ">= 1.5.2" gem "rake", "~> 13.0", ">= 13.0.6" gem "reek", "~> 6.1", ">= 6.1.4" gem "require_all", "~> 3.0" -gem 'rubocop', '~> 1.69', '>= 1.69.2' -gem 'rubocop-minitest', '~> 0.36.0' -gem 'rubocop-rake', '~> 0.6.0' +gem "rubocop", "~> 1.69", ">= 1.69.2" +gem "rubocop-minitest", "~> 0.36.0" +gem "rubocop-rake", "~> 0.6.0" gem "standard", "~> 1.31", ">= 1.31.1" gem "vcr", "~> 6.3", ">= 6.3.1" gem "webmock", "~> 3.24" diff --git a/imdb_title.gemspec b/imdb_title.gemspec index e4ec1ad..6308aca 100644 --- a/imdb_title.gemspec +++ b/imdb_title.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |s| "source_code_uri" => "https://github.com/JuzerShakir/imdb", "changelog_uri" => "https://github.com/JuzerShakir/imdb/blob/master/CHANGELOG.md", "bug_tracker_uri" => "https://github.com/JuzerShakir/imdb/issues", - 'rubygems_mfa_required' => 'true' + "rubygems_mfa_required" => "true" } s.add_dependency "httparty", "~> 0.21.0" s.add_dependency "nokogiri", "~> 1.15", ">= 1.15.4" diff --git a/test/titles/episode_test.rb b/test/titles/episode_test.rb index 815453b..d4c45b4 100644 --- a/test/titles/episode_test.rb +++ b/test/titles/episode_test.rb @@ -7,15 +7,16 @@ class EpisodeTest < TestHelper ID = "tt9166672" # open wide, o earth - def test_title = super title.title, "Open Wide, O Earth" + def test_title = super(title.title, "Open Wide, O Earth") def test_release_date release_date = title.release_date - super release_date + super(release_date) + assert_equal("May 20, 2019 (United States)", release_date) end - def test_duration = super title.duration, "1 hour 5 minutes" + def test_duration = super(title.duration, "1 hour 5 minutes") def test_instance_of_class = assert_kind_of(Episode, title) end diff --git a/test/titles/in_development_test.rb b/test/titles/in_development_test.rb index 7b6ab88..8532043 100644 --- a/test/titles/in_development_test.rb +++ b/test/titles/in_development_test.rb @@ -7,10 +7,11 @@ class TitleInDevelopmentTest < TestHelper ID = "tt4576032" # blade - def test_title = super title.title, "300: The Resurgence" + def test_title = super(title.title, "300: The Resurgence") def test_tagline tagline = title.tagline + assert(tagline.is_a?(String) || tagline.nil?) end @@ -20,5 +21,5 @@ def test_popularity = assert_nil(title.popularity) def test_release_date = assert_nil(title.release_date) - def test_production_companies = super title.production_companies + def test_production_companies = super(title.production_companies) end diff --git a/test/titles/movie_test.rb b/test/titles/movie_test.rb index b6901dd..609961a 100644 --- a/test/titles/movie_test.rb +++ b/test/titles/movie_test.rb @@ -9,18 +9,20 @@ class MovieTest < TestHelper def test_instance_of_class = assert_kind_of(Movie, title) - def test_title = super title.title, "The Shawshank Redemption" + def test_title = super(title.title, "The Shawshank Redemption") - def test_duration = super title.duration, "2 hours 22 minutes" + def test_duration = super(title.duration, "2 hours 22 minutes") def test_budget budget = title.budget + assert_kind_of(String, budget) assert_match(/\A\$\d+(?:,\d{3})*\z/, budget) end def test_revenue revenue = title.revenue + assert_kind_of(String, revenue) assert_match(/\A\$\d+(?:,\d{3})*\z/, revenue) end diff --git a/test/titles/tv_show_test.rb b/test/titles/tv_show_test.rb index 25d483b..1883594 100644 --- a/test/titles/tv_show_test.rb +++ b/test/titles/tv_show_test.rb @@ -7,9 +7,9 @@ class TvShowTest < TestHelper ID = "tt0903747" # breaking bad - def test_title = super title.title, "Breaking Bad" + def test_title = super(title.title, "Breaking Bad") - def test_duration = super title.duration, "45 minutes" + def test_duration = super(title.duration, "45 minutes") def test_instance_of_class = assert_kind_of(TvShow, title) end diff --git a/test/titles/video_game_test.rb b/test/titles/video_game_test.rb index 465df9d..d65989d 100644 --- a/test/titles/video_game_test.rb +++ b/test/titles/video_game_test.rb @@ -7,11 +7,12 @@ class VideoGameTest < TestHelper ID = "tt2140553" # the last of us - def test_title = super title.title, "The Last of Us" + def test_title = super(title.title, "The Last of Us") def test_release_date release_date = title.release_date - super release_date + super(release_date) + assert_equal("June 14, 2013 (United States)", release_date) end From e5b6381fc98580d0836c35987f96a20db4f491e3 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 17:16:54 +0530 Subject: [PATCH 15/18] Update `TargetRubyVersion` to `3.2.2` --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index b8ddd6e..34ae2b2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,7 +15,7 @@ inherit_gem: standard: config/base.yml AllCops: - TargetRubyVersion: "3.0.0" + TargetRubyVersion: 3.2.2 NewCops: enable Exclude: - "test.rb" From 9a518920c170501ec7cb2971f5c5c9ad55818fc1 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 17:17:36 +0530 Subject: [PATCH 16/18] Update `require_ruby_version` to `>=2.7.0` --- imdb_title.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imdb_title.gemspec b/imdb_title.gemspec index 6308aca..d6b8acd 100644 --- a/imdb_title.gemspec +++ b/imdb_title.gemspec @@ -22,5 +22,5 @@ Gem::Specification.new do |s| } s.add_dependency "httparty", "~> 0.21.0" s.add_dependency "nokogiri", "~> 1.15", ">= 1.15.4" - s.required_ruby_version = ">= 3.0.0" + s.required_ruby_version = ">= 2.7.0" end From 80b9973fa0b8d934d15f6f33867d27609bd040a2 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 17:18:29 +0530 Subject: [PATCH 17/18] Run `rubocop` command to check for offenses in CI --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index c616c7a..c61b7cb 100644 --- a/Rakefile +++ b/Rakefile @@ -47,6 +47,6 @@ end desc "linting & code smell detector" task :analysis do - sh "standardrb" + sh "rubocop" sh "reek" end From 62e7d540c5d2495054b51303ef963b705d96cc38 Mon Sep 17 00:00:00 2001 From: Juzer Shakir Date: Fri, 27 Dec 2024 17:26:22 +0530 Subject: [PATCH 18/18] FIX `DuplicateMethodCall` offense --- test/exceptions_test.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/exceptions_test.rb b/test/exceptions_test.rb index d3cb4a3..b71ff05 100644 --- a/test/exceptions_test.rb +++ b/test/exceptions_test.rb @@ -7,7 +7,9 @@ class ExceptionsTest < Minitest::Test def test_invalid_url assert_raises(IMDb::InvalidURL) { IMDb::Title.new("http://www.example.com") } + end + def test_invalid_id VCR.use_cassette("wrong_id") do assert_raises(IMDb::InvalidURL) { IMDb::Title.new("https://www.imdb.com/title/tt549199490/") } end