From 75ab2b3f0628276b0d7e531fa8d00f980269f2db Mon Sep 17 00:00:00 2001 From: Peter Postma Date: Sun, 10 Nov 2024 13:57:32 +0100 Subject: [PATCH] Update dev dependencies: RuboCop & RSpec --- .rubocop.yml | 3 ++ Gemfile.lock | 53 ++++++++++--------- lib/smart_paginate/active_record_extension.rb | 2 +- smart_paginate.gemspec | 4 +- .../active_record_extension_spec.rb | 10 ++-- spec/smart_paginate/paginating_array_spec.rb | 6 +-- 6 files changed, 41 insertions(+), 37 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 8cbf09c..7084b14 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -13,6 +13,9 @@ AllCops: - 'lib/smart_paginate/version.rb' - 'vendor/**/*' +Gemspec/DevelopmentDependencies: + EnforcedStyle: gemspec + Layout/LineLength: Enabled: false diff --git a/Gemfile.lock b/Gemfile.lock index 3f1bf5f..38e9cf7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,6 +36,8 @@ GEM drb (2.2.1) i18n (1.14.6) concurrent-ruby (~> 1.0) + json (2.8.1) + language_server-protocol (3.17.0.3) logger (1.6.1) minitest (5.25.1) parallel (1.26.3) @@ -46,39 +48,38 @@ GEM rainbow (3.1.1) rake (13.2.1) regexp_parser (2.9.2) - rexml (3.3.9) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.3) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.4) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.7) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-support (3.12.2) - rubocop (1.12.1) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + rubocop (1.68.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.2.0, < 2.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) + unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.34.1) parser (>= 3.3.1.0) - rubocop-performance (1.19.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) + rubocop-performance (1.22.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (2.4.0) - rubocop (~> 1.0) - rubocop-ast (>= 1.1.0) + rubocop-rspec (3.2.0) + rubocop (~> 1.61) ruby-progressbar (1.13.0) securerandom (0.3.1) sqlite3 (2.2.0-x86_64-darwin) @@ -95,8 +96,8 @@ DEPENDENCIES activerecord (~> 8.0.0) bundler (>= 1.12) rake (~> 13.0) - rspec (~> 3.12.0) - rubocop (~> 1.12.0) + rspec (~> 3.13.0) + rubocop (~> 1.68.0) rubocop-performance rubocop-rake rubocop-rspec diff --git a/lib/smart_paginate/active_record_extension.rb b/lib/smart_paginate/active_record_extension.rb index b78acc7..32d697d 100644 --- a/lib/smart_paginate/active_record_extension.rb +++ b/lib/smart_paginate/active_record_extension.rb @@ -30,7 +30,7 @@ def count(*args) rel = except(:limit).limit(per_page) rel.count(*args) else - super(*args) + super end end diff --git a/smart_paginate.gemspec b/smart_paginate.gemspec index 3e2fac9..cd0152a 100644 --- a/smart_paginate.gemspec +++ b/smart_paginate.gemspec @@ -26,8 +26,8 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '>= 1.12' spec.add_development_dependency 'rake', '~> 13.0' - spec.add_development_dependency 'rspec', '~> 3.12.0' - spec.add_development_dependency 'rubocop', '~> 1.12.0' + spec.add_development_dependency 'rspec', '~> 3.13.0' + spec.add_development_dependency 'rubocop', '~> 1.68.0' spec.add_development_dependency 'rubocop-performance' spec.add_development_dependency 'rubocop-rake' spec.add_development_dependency 'rubocop-rspec' diff --git a/spec/smart_paginate/active_record_extension_spec.rb b/spec/smart_paginate/active_record_extension_spec.rb index 0f4f6ab..55781b7 100644 --- a/spec/smart_paginate/active_record_extension_spec.rb +++ b/spec/smart_paginate/active_record_extension_spec.rb @@ -52,7 +52,7 @@ it 'returns nil after the last page' do users = User.order(:name).paginate(per_page: 1, page: 11) expect(users.length).to eq(0) - expect(users.first).to be nil + expect(users.first).to be_nil end end @@ -182,12 +182,12 @@ it 'returns nil when no pages are present' do users = User.paginate(per_page: 1, page: 1) - expect(users.previous_page).to be nil + expect(users.previous_page).to be_nil end it 'returns nil when there are no records' do users = User.nothing.paginate(per_page: 1, page: 1) - expect(users.previous_page).to be nil + expect(users.previous_page).to be_nil end end @@ -204,12 +204,12 @@ it 'returns nil when no pages are present' do users = User.paginate(per_page: 1, page: 10) - expect(users.next_page).to be nil + expect(users.next_page).to be_nil end it 'returns nil when there are no records' do users = User.nothing.paginate(per_page: 1, page: 1) - expect(users.next_page).to be nil + expect(users.next_page).to be_nil end end end diff --git a/spec/smart_paginate/paginating_array_spec.rb b/spec/smart_paginate/paginating_array_spec.rb index 2fa29b0..e40a41b 100644 --- a/spec/smart_paginate/paginating_array_spec.rb +++ b/spec/smart_paginate/paginating_array_spec.rb @@ -36,7 +36,7 @@ it 'returns nil after the last page' do users = array.paginate(per_page: 1, page: 20) expect(users.length).to eq(0) - expect(users.first).to be nil + expect(users.first).to be_nil end it 'does not modify the original array when paginating' do @@ -131,7 +131,7 @@ it 'returns nil when no pages are present' do users = array.paginate(per_page: 1, page: 1) - expect(users.previous_page).to be nil + expect(users.previous_page).to be_nil end end @@ -148,7 +148,7 @@ it 'returns nil when no pages are present' do users = array.paginate(per_page: 1, page: 10) - expect(users.next_page).to be nil + expect(users.next_page).to be_nil end end end