diff --git a/.travis.yml b/.travis.yml index 230ee1b..bc9154b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,8 @@ before_install: - gem install bundler gemfile: - - gemfiles/rails_4.2.gemfile + # ignore 4.2 for now as the cost to run these tests is too high + # - gemfiles/rails_4.2.gemfile - gemfiles/rails_5.0.gemfile - gemfiles/rails_5.1.gemfile - gemfiles/rails_5.2.gemfile diff --git a/Appraisals b/Appraisals index b243104..82d15ad 100644 --- a/Appraisals +++ b/Appraisals @@ -1,10 +1,10 @@ -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-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.0' do gem 'rails', '>= 5.0.0', '< 5.1' diff --git a/awesome_print.gemspec b/awesome_print.gemspec index a2f117f..25cce46 100644 --- a/awesome_print.gemspec +++ b/awesome_print.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |s| s.require_paths = ['lib'] s.add_development_dependency 'rspec', '>= 3.0.0' - s.add_development_dependency 'appraisal', '= 2.0.0' + s.add_development_dependency 'appraisal' s.add_development_dependency 'fakefs', '>= 0.2.1' s.add_development_dependency 'sqlite3' s.add_development_dependency 'nokogiri', '>= 1.6.5' diff --git a/gemfiles/mongoid_4.0.gemfile b/gemfiles/mongoid_4.0.gemfile index 5a038c1..c899518 100644 --- a/gemfiles/mongoid_4.0.gemfile +++ b/gemfiles/mongoid_4.0.gemfile @@ -4,4 +4,4 @@ source "https://rubygems.org" gem "mongoid", "~> 4.0.0" -gemspec :path => "../" +gemspec path: "../" diff --git a/gemfiles/mongoid_5.0.gemfile b/gemfiles/mongoid_5.0.gemfile index 225d377..4404aeb 100644 --- a/gemfiles/mongoid_5.0.gemfile +++ b/gemfiles/mongoid_5.0.gemfile @@ -4,4 +4,4 @@ source "https://rubygems.org" gem "mongoid", "~> 5.0.0" -gemspec :path => "../" +gemspec path: "../" diff --git a/gemfiles/mongoid_6.0.gemfile b/gemfiles/mongoid_6.0.gemfile index 0eea277..dc461ad 100644 --- a/gemfiles/mongoid_6.0.gemfile +++ b/gemfiles/mongoid_6.0.gemfile @@ -4,4 +4,4 @@ source "https://rubygems.org" gem "mongoid", "~> 6.0.0" -gemspec :path => "../" +gemspec path: "../" diff --git a/gemfiles/rails_4.2.gemfile b/gemfiles/rails_4.2.gemfile index 2fb73f1..aa2a7ea 100644 --- a/gemfiles/rails_4.2.gemfile +++ b/gemfiles/rails_4.2.gemfile @@ -3,6 +3,6 @@ source "https://rubygems.org" gem "rails", "~> 4.2.0" -gem "mime-types", "2.6.2", :platforms => :ruby_19 +gem "mime-types", "2.6.2", platforms: :ruby_19 -gemspec :path => "../" +gemspec path: "../" diff --git a/gemfiles/rails_5.0.gemfile b/gemfiles/rails_5.0.gemfile index 0588df0..4c5cb4b 100644 --- a/gemfiles/rails_5.0.gemfile +++ b/gemfiles/rails_5.0.gemfile @@ -4,4 +4,4 @@ source "https://rubygems.org" gem "rails", ">= 5.0.0", "< 5.1" -gemspec :path => "../" +gemspec path: "../" diff --git a/gemfiles/rails_5.1.gemfile b/gemfiles/rails_5.1.gemfile index c78e558..d974e25 100644 --- a/gemfiles/rails_5.1.gemfile +++ b/gemfiles/rails_5.1.gemfile @@ -4,4 +4,4 @@ source "https://rubygems.org" gem "rails", ">= 5.1.0", "< 5.2" -gemspec :path => "../" +gemspec path: "../" diff --git a/gemfiles/rails_5.2.gemfile b/gemfiles/rails_5.2.gemfile index 00c0b13..a3348a9 100644 --- a/gemfiles/rails_5.2.gemfile +++ b/gemfiles/rails_5.2.gemfile @@ -4,4 +4,4 @@ source "https://rubygems.org" gem "rails", ">= 5.2.0", "< 5.3" -gemspec :path => "../" +gemspec path: "../" diff --git a/spec/ext/active_record_spec.rb b/spec/ext/active_record_spec.rb index 0caf3ba..9d024b7 100644 --- a/spec/ext/active_record_spec.rb +++ b/spec/ext/active_record_spec.rb @@ -233,7 +233,7 @@ class SubUser < User { out = @ap.awesome(User.methods.grep(/first/)) if ActiveRecord::VERSION::STRING >= '3.2' - if RUBY_VERSION >= '2.5' + if RUBY_VERSION >= '2.4.4' expect(out).to match(/\sfirst\(\*arg.*?\)\s+User/) elsif RUBY_VERSION >= '1.9' expect(out).to match(/\sfirst\(\*args,\s&block\)\s+Class \(ActiveRecord::Querying\)/) @@ -246,7 +246,7 @@ class SubUser < User { # spec 2 out = @ap.awesome(User.methods.grep(/primary_key/)) - if RUBY_VERSION >= '2.5' + if RUBY_VERSION >= '2.4.4' expect(out).to match(/\sprimary_key\(.*?\)\s+User/) else expect(out).to match(/\sprimary_key\(.*?\)\s+Class \(ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods\)/) @@ -258,7 +258,7 @@ class SubUser < User { if ActiveRecord::VERSION::MAJOR < 3 expect(out).to match(/\svalidate\(\*arg.*?\)\s+User \(ActiveRecord::Base\)/) else - if RUBY_VERSION >= '2.5' + if RUBY_VERSION >= '2.4.4' expect(out).to match(/\svalidate\(\*arg.*?\)\s+User/) else expect(out).to match(/\svalidate\(\*arg.*?\)\s+Class \(ActiveModel::Validations::ClassMethods\)/) diff --git a/spec/ext/mongoid_spec.rb b/spec/ext/mongoid_spec.rb index 2eb29c8..cb8e7f3 100644 --- a/spec/ext/mongoid_spec.rb +++ b/spec/ext/mongoid_spec.rb @@ -38,32 +38,13 @@ RSpec.describe 'AwesomePrint/Mongoid', skip: -> { !ExtVerifier.has_mongoid? }.ca end it 'should print the class' do - class_spec = if mongoid_3_0? - <<-EOS.strip -class MongoUser < Object { - :_id => :"moped/bson/object_id", - :_type => :string, - :first_name => :string, - :last_name => :string -} - EOS - elsif mongoid_3_1? - <<-EOS.strip -class MongoUser < Object { - :_id => :"moped/bson/object_id", - :first_name => :string, - :last_name => :string -} - EOS - elsif mongoid_4_0? - <<-EOS.strip + class_spec = <<-EOS.strip class MongoUser < Object { :_id => :"bson/object_id", :first_name => :string, :last_name => :string } EOS - end expect(@ap.send(:awesome, MongoUser)).to eq class_spec end @@ -74,30 +55,12 @@ class MongoUser < Object { field :last_attribute end - class_spec = if mongoid_3_0? - <<-EOS.strip -class Chamelion < Object { - :_id => :"moped/bson/object_id", - :_type => :string, - :last_attribute => :object -} - EOS - elsif mongoid_3_1? - <<-EOS.strip -class Chamelion < Object { - :_id => :"moped/bson/object_id", - :last_attribute => :object -} - EOS - elsif mongoid_4_0? - <<-EOS.strip + class_spec = <<-EOS.strip class Chamelion < Object { :_id => :"bson/object_id", :last_attribute => :object } EOS - end - expect(@ap.send(:awesome, Chamelion)).to eq class_spec end diff --git a/spec/support/mongoid_versions.rb b/spec/support/mongoid_versions.rb index 7cfadd6..0cfb569 100644 --- a/spec/support/mongoid_versions.rb +++ b/spec/support/mongoid_versions.rb @@ -7,12 +7,12 @@ module MongoidVersions Gem::Requirement.new('~> 4.0.0').satisfied_by?(mongoid_version) end - def mongoid_3_0? - Gem::Requirement.new('~> 3.0.0').satisfied_by?(mongoid_version) + def mongoid_5_0? + Gem::Requirement.new('~> 5.0.0').satisfied_by?(mongoid_version) end - def mongoid_3_1? - Gem::Requirement.new('~> 3.1.0').satisfied_by?(mongoid_version) + def mongoid_6_0? + Gem::Requirement.new('~> 6.0.0').satisfied_by?(mongoid_version) end end