BigDecimal required; test fixes for ruby 3 (#408)

This commit is contained in:
Bryan Hanks, PMP 2021-03-02 08:33:02 -06:00 committed by GitHub
parent 8df1675962
commit 9ae56ba413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 6 deletions

View File

@ -29,6 +29,7 @@ end
appraise 'mongoid-5.0' do
gem 'mongoid', '~> 5.0.0'
gem 'bigdecimal', '~> 1.3.5'
end
appraise 'mongoid-6.0' do

View File

@ -3,5 +3,6 @@
source "https://rubygems.org"
gem "mongoid", "~> 5.0.0"
gem "bigdecimal", "~> 1.3.5"
gemspec path: "../"

View File

@ -218,25 +218,43 @@ class SubUser < User {
# spec 1
out = @ap.awesome(User.methods.grep(/first/))
if ActiveRecord::VERSION::STRING >= '3.2'
expect(out).to match(/\sfirst\(\*arg.*?\)\s+User/)
if RUBY_VERSION >= '3.0.0'
expect(out).to match(/\sfirst\(\*\*,\s&&\)/)
elsif RUBY_VERSION >= '2.7.0'
if ActiveRecord::VERSION::STRING >= '3.2'
expect(out).to match(/\sfirst\(\*\*,\s&&\)\s+User/)
else
expect(out).to match(/\sfirst\(\*\*,\s&&\)\s+User \(ActiveRecord::Base\)/)
end
else
expect(out).to match(/\sfirst\(\*arg.*?\)\s+User \(ActiveRecord::Base\)/)
if ActiveRecord::VERSION::STRING >= '3.2'
expect(out).to match(/\sfirst\(\*arg.*?\)\s+User/)
else
expect(out).to match(/\sfirst\(\*arg.*?\)\s+User \(ActiveRecord::Base\)/)
end
end
# spec 2
out = @ap.awesome(User.methods.grep(/primary_key/))
expect(out).to match(/\sprimary_key\(.*?\)\s+User/)
if RUBY_VERSION >= '3.0.0'
expect(out).to match(/\sprimary_key\(.*?\)/)
else
expect(out).to match(/\sprimary_key\(.*?\)\s+User/)
end
# spec 3
out = @ap.awesome(User.methods.grep(/validate/))
if ActiveRecord::VERSION::MAJOR < 3
expect(out).to match(/\svalidate\(\*arg.*?\)\s+User \(ActiveRecord::Base\)/)
else
expect(out).to match(/\svalidate\(\*arg.*?\)\s+User/)
if RUBY_VERSION >= '3.0.0'
expect(out).to match(/\svalidate\(\*arg.*?\)/)
else
expect(out).to match(/\svalidate\(\*arg.*?\)\s+User/)
end
end
end
end
end