Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update specs for Ruby 3.0 #69

Merged
merged 1 commit into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- "2.5"
- "2.6"
- "2.7"
- "3.0"
- "head"
- "jruby"
runs-on: ${{ matrix.os }}-latest
Expand Down
88 changes: 41 additions & 47 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
# frozen_string_literal: true

# appraise 'rails-4.2' do
# gem 'rails', '~> 4.2.0'
#
# # The last version that doesn't need Ruby 2.0 and works with version 4.2 of
# # Rails. This addresses a build problem with Travis for version 1.9.3 of Ruby
# gem 'mime-types', '2.6.2', :platforms => :ruby_19
# end

appraise 'rails-5.1' do
gem 'activerecord-jdbcsqlite3-adapter', '~> 51.0', platform: :jruby
gem 'rails', '~> 5.1.0'
gem 'sqlite3', platform: :mri
end

appraise 'rails-5.2' do
gem 'activerecord-jdbcsqlite3-adapter', '~> 52.0', platform: :jruby
gem 'rails', '~> 5.2.0'
gem 'sqlite3', platform: :mri
end

appraise 'rails-6.0' do
gem 'activerecord-jdbcsqlite3-adapter', '~> 60.0', platform: :jruby
gem 'rails', '~> 6.0.0'
gem 'sqlite3', platform: :mri
if RUBY_VERSION < '3'
appraise 'rails-5.1' do
gem 'activerecord-jdbcsqlite3-adapter', '~> 51.0', platform: :jruby
gem 'rails', '~> 5.1.0'
gem 'sqlite3', platform: :mri
end

appraise 'rails-5.2' do
gem 'activerecord-jdbcsqlite3-adapter', '~> 52.0', platform: :jruby
gem 'rails', '~> 5.2.0'
gem 'sqlite3', platform: :mri
end

appraise 'rails-6.0' do
gem 'activerecord-jdbcsqlite3-adapter', '~> 60.0', platform: :jruby
gem 'rails', '~> 6.0.0'
gem 'sqlite3', platform: :mri
end

appraise 'mongoid-4.0' do
# https://github.com/rails/rails/issues/34822#issuecomment-570670516
gem 'bigdecimal', '~> 1.4', platforms: :mri
gem 'mongoid', '~> 4.0.0'
end

appraise 'mongoid-5.0' do
# https://github.com/rails/rails/issues/34822#issuecomment-570670516
gem 'bigdecimal', '~> 1.4', platforms: :mri
gem 'mongoid', '~> 5.0.0'
end

appraise 'mongoid-6.0' do
gem 'mongoid', '~> 6.0.0'
end

appraise 'mongo_mapper' do
gem 'activemodel', '~> 4.2.0'
gem 'activesupport', '~> 4.2.0'
gem 'bigdecimal', '~> 1.4', platforms: :mri
gem 'mongo_mapper', '~> 0.14'
end
end

appraise 'rails-6.1' do
Expand All @@ -32,29 +49,6 @@ appraise 'rails-6.1' do
gem 'sqlite3', platform: :mri
end

appraise 'mongoid-4.0' do
# https://github.com/rails/rails/issues/34822#issuecomment-570670516
gem 'bigdecimal', '~> 1.4', platforms: :mri
gem 'mongoid', '~> 4.0.0'
end

appraise 'mongoid-5.0' do
# https://github.com/rails/rails/issues/34822#issuecomment-570670516
gem 'bigdecimal', '~> 1.4', platforms: :mri
gem 'mongoid', '~> 5.0.0'
end

appraise 'mongoid-6.0' do
gem 'mongoid', '~> 6.0.0'
end

appraise 'mongo_mapper' do
gem 'activemodel', '~> 4.2.0'
gem 'activesupport', '~> 4.2.0'
gem 'bigdecimal', '~> 1.4', platforms: :mri
gem 'mongo_mapper', '~> 0.14'
end

appraise 'sequel-5.0' do
gem 'jdbc-sqlite3', platform: :jruby
gem 'sequel', '~> 5.0'
Expand Down
8 changes: 8 additions & 0 deletions spec/ext/active_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ class SubUser < User {
expect(out).to match(
/\s+first\(\*args,\s&block\)\s+#<Class:\w+>\s+\(ActiveRecord::Querying\)/
)
elsif RUBY_VERSION >= '3.0.0'
expect(out).to match(
/\s*first\(\*(\*|args),\s+&(&|block)\)\s+#<Class:User> \(ActiveRecord::Querying\)/
)
elsif RUBY_VERSION >= '2.7.2'
expect(out).to match(
/\s*first\(\*(\*|args),\s+&(&|block)\)\s+User/
Expand All @@ -286,6 +290,8 @@ class SubUser < User {
expect(out).to match(
/\sprimary_key\(.*?\)\s+#<Class:\w+>\s\(ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods\)/
)
elsif RUBY_VERSION >= '3.0.0'
expect(out).to match(/\sprimary_key\(.*?\)\s+#<Class:User> \(ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods\)/)
elsif RUBY_VERSION =~ /^2\.7\.(0|1)/
expect(out).to match(
/\sprimary_key\(.*?\)\s+.+Class.+\(ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods\)/
Expand All @@ -304,6 +310,8 @@ class SubUser < User {
else
if RUBY_PLATFORM == 'java'
expect(out).to match(/\svalidate\(\*arg.*?\)\s+#<Class:\w+> \(ActiveModel::Validations::ClassMethods\)/)
elsif RUBY_VERSION >= '3.0.0'
expect(out).to match(/\svalidate\(\*arg.*?\)\s+#<Class:User> \(ActiveModel::Validations::ClassMethods\)/)
elsif RUBY_VERSION =~ /2\.7\.(0|1)/
expect(out).to match(
/\svalidate\(\*args.*?\)\s+#<Class:ActiveRecord::Base> \(ActiveModel::Validations::ClassMethods\)/
Expand Down