Skip to content

Commit

Permalink
Merge branch 'ruby-2.7-warnings'
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Feb 26, 2020
2 parents a857575 + adf524b commit 434b1b8
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 89 deletions.
11 changes: 0 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ before_script:
- mysql -e 'create database will_paginate;'
- psql -c 'create database will_paginate;' -U postgres
rvm:
- 1.9.3
- 2.1.8
- 2.2.7
- 2.3.8
Expand All @@ -32,8 +31,6 @@ gemfile:
- Gemfile.rails-edge
matrix:
exclude:
- rvm: 1.9.3
gemfile: Gemfile
- rvm: 2.1.8
gemfile: Gemfile
- rvm: 2.2.7
Expand Down Expand Up @@ -84,20 +81,12 @@ matrix:
gemfile: Gemfile.rails4.1
- rvm: 2.7.0
gemfile: Gemfile.rails4.2
- rvm: 1.9.3
gemfile: Gemfile.rails5.0
- rvm: 2.1.8
gemfile: Gemfile.rails5.0
- rvm: 1.9.3
gemfile: Gemfile.rails5.1
- rvm: 2.1.8
gemfile: Gemfile.rails5.1
- rvm: 1.9.3
gemfile: Gemfile.rails5.2
- rvm: 2.1.8
gemfile: Gemfile.rails5.2
- rvm: 1.9.3
gemfile: Gemfile.rails-edge
- rvm: 2.1.8
gemfile: Gemfile.rails-edge
- rvm: 2.2.7
Expand Down
12 changes: 7 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ rails_version = '~> 6.0.2'
gem 'activerecord', rails_version
gem 'actionpack', rails_version

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.4.0'

gem 'mysql2', '~> 0.5.2', :group => :mysql
gem 'pg', '~> 0.18.4', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
gem 'sequel', '~> 5.29'
gem 'dm-core'
gem 'dm-aggregates'
gem 'dm-migrations'
gem 'dm-sqlite-adapter'
gem 'mongoid', '~> 7.0.4'
6 changes: 1 addition & 5 deletions Gemfile.rails-edge
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ gem 'actionpack', git: 'https://github.com/rails/rails.git', branch: 'master'

gem 'thread_safe'

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.4.0'

gem 'mysql2', '~> 0.5.2', :group => :mysql
gem 'pg', '~> 0.11', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
6 changes: 1 addition & 5 deletions Gemfile.rails3.0
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gem 'activerecord', rails_version
gem 'actionpack', rails_version
gem 'i18n', '< 0.7'

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.3'
Expand All @@ -17,7 +17,3 @@ group :mysql do
gem 'activerecord-mysql2-adapter'
end
gem 'pg', '< 0.18', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
6 changes: 1 addition & 5 deletions Gemfile.rails3.1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem 'actionpack', rails_version
gem 'i18n', '< 0.7'
gem 'rack-cache', '~> 1.2.0'

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.3'
Expand All @@ -17,7 +17,3 @@ group :mysql do
gem 'mysql2', '~> 0.4.6'
end
gem 'pg', '< 0.18', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
6 changes: 1 addition & 5 deletions Gemfile.rails3.2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem 'actionpack', rails_version
gem 'i18n', '< 0.7'
gem 'rack-cache', '~> 1.2.0'

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.3'
Expand All @@ -17,7 +17,3 @@ group :mysql do
gem 'mysql2', '~> 0.4.6'
end
gem 'pg', '< 0.18', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
6 changes: 1 addition & 5 deletions Gemfile.rails4.0
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rails_version = '~> 4.0.13'
gem 'activerecord', rails_version
gem 'actionpack', rails_version

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.6'
Expand All @@ -15,7 +15,3 @@ group :mysql do
gem 'mysql2', '~> 0.4.6'
end
gem 'pg', '~> 0.18.4', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
6 changes: 1 addition & 5 deletions Gemfile.rails4.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rails_version = '~> 4.1.16'
gem 'activerecord', rails_version
gem 'actionpack', rails_version

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.6'
Expand All @@ -15,7 +15,3 @@ group :mysql do
gem 'mysql2', '~> 0.4.6'
end
gem 'pg', '~> 0.18.4', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
6 changes: 1 addition & 5 deletions Gemfile.rails4.2
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ gem 'actionpack', rails_version
gem 'rails-dom-testing'
gem 'nokogiri', '~> 1.6.8'

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.6'

gem 'mysql2', '~> 0.4.6', :group => :mysql
gem 'pg', '~> 0.18.4', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
6 changes: 1 addition & 5 deletions Gemfile.rails5.0
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ gem 'activerecord', rails_version
gem 'actionpack', rails_version
gem 'rails-dom-testing'

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.6'

gem 'mysql2', '~> 0.4.6', :group => :mysql
gem 'pg', '~> 0.11', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
6 changes: 1 addition & 5 deletions Gemfile.rails5.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ rails_version = '~> 5.1.7'
gem 'activerecord', rails_version
gem 'actionpack', rails_version

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.6'

gem 'mysql2', '~> 0.5.2', :group => :mysql
gem 'pg', '~> 0.18.4', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
15 changes: 2 additions & 13 deletions Gemfile.rails5.2
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
source 'https://rubygems.org'

rails_version = '~> 5.2.4.1'
rails_version = '~> 5.2.4'

gem 'activerecord', rails_version
gem 'actionpack', rails_version

gem 'rspec', '~> 2.7.0'
gem 'rspec', '~> 2.99'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.6'
gem 'sequel', '~> 3.8'
gem 'dm-core'
gem 'dm-aggregates'
gem 'dm-migrations'
gem 'dm-sqlite-adapter'
gem 'mongoid', '~> 7.0.4'

gem 'mysql2', '~> 0.5.2', :group => :mysql
gem 'pg', '~> 0.18.4', :group => :pg

group :development do
gem 'debugger', :platforms => :mri_19
end
2 changes: 1 addition & 1 deletion lib/will_paginate/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def will_paginate_translate(keys, options = {}, &block)
if defined? ::I18n
defaults = Array(keys).dup
defaults << block if block_given?
::I18n.translate(defaults.shift, options.merge(:default => defaults, :scope => :will_paginate))
::I18n.translate(defaults.shift, **options.merge(:default => defaults, :scope => :will_paginate))
else
key = Array === keys ? keys.first : keys
yield key, options
Expand Down
1 change: 0 additions & 1 deletion lib/will_paginate/page_number.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'delegate'
require 'forwardable'

module WillPaginate
Expand Down
4 changes: 2 additions & 2 deletions lib/will_paginate/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def status_code_with_paginate(exception = @exception)
end

module ControllerRescuePatch
def rescue_from(*args, &block)
def rescue_from(*args, **kwargs, &block)
if idx = args.index(WillPaginate::InvalidPage)
args[idx] = args[idx].name
end
super(*args, &block)
super(*args, **kwargs, &block)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/will_paginate/view_helpers/action_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def will_paginate_translate(keys, options = {})
defaults = nil
key = keys
end
translate(key, options.merge(:default => defaults, :scope => :will_paginate))
translate(key, **options.merge(:default => defaults, :scope => :will_paginate))
else
super
end
Expand Down
8 changes: 6 additions & 2 deletions script/test_all
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ if [ -z "$BUNDLE_GEMFILE" ]; then
BUNDLE_GEMFILE="$(bundle config gemfile | grep BUNDLE_GEMFILE | head -1 | cut -d'"' -f2)"
fi

if [[ -n "$BUNDLE_GEMFILE" && "${BUNDLE_GEMFILE##*/}" != 'Gemfile.rails5.2' ]]; then
if [[ -n "$BUNDLE_GEMFILE" && "${BUNDLE_GEMFILE##*/}" != 'Gemfile' ]]; then
export SKIP_NONRAILS_TESTS=1
fi

errlog="$(mktemp)"
trap "rm -f '$errlog'" EXIT

for db in sqlite3 mysql mysql2 postgres; do
[[ "$rails_version" = 3.0 && $db = "mysql2" ]] && continue
[[ "$rails_version" > 4.2 && $db = "mysql" ]] && continue
Expand All @@ -23,7 +26,8 @@ for db in sqlite3 mysql mysql2 postgres; do
spec_files="spec"
[[ $db != "sqlite3" ]] && spec_files="spec/finders/active_record_spec.rb"
echo "rspec $spec_files"
DB="$db" rspec -r fake_rubygems "$spec_files" || status="$?"
DB="$db" rspec -r fake_rubygems "$spec_files" 2>>"$errlog" || status="$?"
done

grep -v "$PWD/vendor/" "$errlog" >&2
exit $status
2 changes: 1 addition & 1 deletion spec/finders/active_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
sql = "select content from topics where content like '%futurama%'"
topics = Topic.paginate_by_sql sql, :page => 1, :per_page => 1
topics.total_entries.should == 1
topics.first.attributes.has_key?('title').should be_false
topics.first.attributes.has_key?('title').should be(false)
}.should run_queries(2)
end

Expand Down
2 changes: 2 additions & 0 deletions spec/finders/mongoid_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
require 'will_paginate/mongoid'
Object.send(:const_set, :Rails, old_rails) if old_rails

Mongo::Logger.logger.level = Logger::INFO

Mongoid.connect_to 'will_paginate_test'
class MongoidModel
include Mongoid::Document
Expand Down
13 changes: 7 additions & 6 deletions spec/finders/sequel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
describe Sequel::Dataset::Pagination, 'extension' do

class Car < Sequel::Model
self.dataset = dataset.extension(:pagination)
end

it "should have the #paginate method" do
Car.should respond_to(:paginate)
Car.dataset.should respond_to(:paginate)
end

it "should NOT have the #paginate_by_sql method" do
Car.should_not respond_to(:paginate_by_sql)
Car.dataset.should_not respond_to(:paginate_by_sql)
end

describe 'pagination' do
Expand All @@ -29,7 +30,7 @@ class Car < Sequel::Model
end

it "should imitate WillPaginate::Collection" do
result = Car.paginate(1, 2)
result = Car.dataset.paginate(1, 2)

result.should_not be_empty
result.size.should == 2
Expand All @@ -41,16 +42,16 @@ class Car < Sequel::Model
end

it "should perform" do
Car.paginate(1, 2).all.should == [Car[1], Car[2]]
Car.dataset.paginate(1, 2).all.should == [Car[1], Car[2]]
end

it "should be empty" do
result = Car.paginate(3, 2)
result = Car.dataset.paginate(3, 2)
result.should be_empty
end

it "should perform with #select and #order" do
result = Car.select("name as foo".lit).order(:name).paginate(1, 2).all
result = Car.select(Sequel.lit("name as foo")).order(:name).paginate(1, 2).all
result.size.should == 2
result.first.values[:foo].should == "Aston Martin"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ def show_queries(&block)
}

config.mock_with :mocha
config.backtrace_clean_patterns << /view_example_group/
config.backtrace_exclusion_patterns << /view_example_group/
end
1 change: 1 addition & 0 deletions will_paginate.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ require File.expand_path('../lib/will_paginate/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'will_paginate'
s.version = WillPaginate::VERSION::STRING
s.required_ruby_version = '>= 2.0'

s.summary = "Pagination plugin for web frameworks and other apps"
s.description = "will_paginate provides a simple API for performing paginated queries with Active Record, DataMapper and Sequel, and includes helpers for rendering pagination links in Rails, Sinatra, Hanami, and Merb web apps."
Expand Down

0 comments on commit 434b1b8

Please sign in to comment.