diff --git a/.travis.yml b/.travis.yml index 3f3372863..c0ddcc183 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,43 +11,41 @@ env: - RAILS_VERSION="~> 5.1.0" - RAILS_VERSION="edge" rvm: - - 2.1.10 - - 2.2.7 - - 2.3.4 - - 2.4.1 - - jruby-9.1.8.0 + - 2.2.9 + - 2.3.6 + - 2.4.3 + - 2.5.0 + - jruby-9.1.15.0 - jruby-head - - rbx-2 - ruby-head +before_install: + - "gem install bundler" jdk: oraclejdk8 matrix: allow_failures: - rvm: jruby-head - - rvm: rbx-2 - rvm: ruby-head - env: RAILS_VERSION="edge" - - rvm: jruby-9.1.8.0 + - rvm: jruby-9.1.15.0 env: RAILS_VERSION="~> 5.1.0" fast_finish: true # legacy testing # things still run and we don't have a good reason to break it # but we don't need to keep running the full matrix include: - - rvm: 2.3.4 + - rvm: 2.3.6 env: RAILS_VERSION="~> 3.0.0" - - rvm: 2.3.4 + - rvm: 2.3.6 env: RAILS_VERSION="~> 3.1.0" - - rvm: 2.3.4 + - rvm: 2.3.6 env: RAILS_VERSION="~> 3.2.0" - - rvm: 2.3.4 + - rvm: 2.3.6 env: RAILS_VERSION="~> 4.0.0" - - rvm: 2.3.4 + - rvm: 2.3.6 env: RAILS_VERSION="~> 4.1.0" - exclude: - - rvm: 2.1.10 - env: RAILS_VERSION="~> 5.0.0" - - rvm: 2.1.10 - env: RAILS_VERSION="~> 5.1.0" - rvm: 2.1.10 + env: RAILS_VERSION="~> 4.2.0" + exclude: + - rvm: 2.2.9 env: RAILS_VERSION="edge" sudo: false diff --git a/Gemfile b/Gemfile index a907a282c..ab189562d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,5 @@ source 'https://rubygems.org' -rails_version = ENV['RAILS_VERSION'] || '' - gem 'rake' platforms :ruby do @@ -9,15 +7,18 @@ platforms :ruby do end platforms :jruby do - gem 'jruby-openssl' - if rails_version == 'edge' || rails_version.match(/5\.\d+\.\d+/) - gem 'activerecord-jdbcsqlite3-adapter', - :git => 'https://github.com/jruby/activerecord-jdbc-adapter.git', - :branch => 'rails-5' + if ENV['RAILS_VERSION'] == '~> 4.2.0' + gem 'activerecord-jdbcsqlite3-adapter', '< 50.0' else gem 'activerecord-jdbcsqlite3-adapter' end + gem 'jruby-openssl' gem 'mime-types', ['~> 2.6', '< 2.99'] + if ENV['RAILS_VERSION'] == 'edge' + gem 'railties', :github => 'rails/rails' + else + gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2']) + end end platforms :rbx do diff --git a/lib/delayed/psych_ext.rb b/lib/delayed/psych_ext.rb index 5b12df0c9..8cd941907 100644 --- a/lib/delayed/psych_ext.rb +++ b/lib/delayed/psych_ext.rb @@ -33,7 +33,7 @@ def visit_Psych_Nodes_Mapping(object) # rubocop:disable CyclomaticComplexity, Me case object.tag when %r{^!ruby/object} result = super - if defined?(ActiveRecord::Base) && result.is_a?(ActiveRecord::Base) + if jruby_is_seriously_borked && result.is_a?(ActiveRecord::Base) klass = result.class id = result[klass.primary_key] begin @@ -78,6 +78,13 @@ def visit_Psych_Nodes_Mapping(object) # rubocop:disable CyclomaticComplexity, Me end end + # defined? is triggering something really messed up in + # jruby causing both the if AND else clauses to execute, + # however if the check is run here, everything is fine + def jruby_is_seriously_borked + defined?(ActiveRecord::Base) + end + def resolve_class(klass_name) return nil if !klass_name || klass_name.empty? klass_name.constantize