1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

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 appraise 'mongoid-5.0' do
gem 'mongoid', '~> 5.0.0' gem 'mongoid', '~> 5.0.0'
gem 'bigdecimal', '~> 1.3.5'
end end
appraise 'mongoid-6.0' do appraise 'mongoid-6.0' do

View file

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

View file

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