diff --git a/Appraisals b/Appraisals index 2933392..79bf826 100644 --- a/Appraisals +++ b/Appraisals @@ -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 diff --git a/gemfiles/mongoid_5.0.gemfile b/gemfiles/mongoid_5.0.gemfile index 4404aeb..c011fc4 100644 --- a/gemfiles/mongoid_5.0.gemfile +++ b/gemfiles/mongoid_5.0.gemfile @@ -3,5 +3,6 @@ source "https://rubygems.org" gem "mongoid", "~> 5.0.0" +gem "bigdecimal", "~> 1.3.5" gemspec path: "../" diff --git a/spec/ext/active_record_spec.rb b/spec/ext/active_record_spec.rb index 603632a..32ef3f3 100644 --- a/spec/ext/active_record_spec.rb +++ b/spec/ext/active_record_spec.rb @@ -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 +