From 52933a1c74d69a043746e60ef615949d01a91f17 Mon Sep 17 00:00:00 2001 From: James Cox Date: Wed, 23 Jan 2019 14:19:44 -0500 Subject: [PATCH] remove references to older rubies --- spec/formatters/ext/active_record_spec.rb | 80 ++++------------------- 1 file changed, 13 insertions(+), 67 deletions(-) diff --git a/spec/formatters/ext/active_record_spec.rb b/spec/formatters/ext/active_record_spec.rb index 9d024b7..9939995 100644 --- a/spec/formatters/ext/active_record_spec.rb +++ b/spec/formatters/ext/active_record_spec.rb @@ -21,11 +21,7 @@ RSpec.describe 'AwesomePrint/ActiveRecord', skip: -> { !ExtVerifier.has_rails? } :rank => 1 } EOS - if RUBY_VERSION < '1.9' - str.sub!('?', 'Sat Oct 10 12:30:00 UTC 1992') - else - str.sub!('?', '1992-10-10 12:30:00 UTC') - end + str.sub!('?', '1992-10-10 12:30:00 UTC') expect(out).to be_similar_to(str) end @@ -49,13 +45,8 @@ RSpec.describe 'AwesomePrint/ActiveRecord', skip: -> { !ExtVerifier.has_rails? } } ] EOS - if RUBY_VERSION < '1.9' - str.sub!('??', 'Sat Oct 10 12:30:00 UTC 1992') - str.sub!('?!', 'Mon May 26 14:15:00 UTC 2003') - else - str.sub!('??', '1992-10-10 12:30:00 UTC') - str.sub!('?!', '2003-05-26 14:15:00 UTC') - end + str.sub!('??', '1992-10-10 12:30:00 UTC') + str.sub!('?!', '2003-05-26 14:15:00 UTC') expect(out).to be_similar_to(str) end @@ -81,13 +72,8 @@ RSpec.describe 'AwesomePrint/ActiveRecord', skip: -> { !ExtVerifier.has_rails? } } ] EOS - if RUBY_VERSION < '1.9' - str.sub!('??', 'Sat Oct 10 12:30:00 UTC 1992') - str.sub!('?!', 'Mon May 26 14:15:00 UTC 2003') - else - str.sub!('??', '1992-10-10 12:30:00 UTC') - str.sub!('?!', '2003-05-26 14:15:00 UTC') - end + str.sub!('??', '1992-10-10 12:30:00 UTC') + str.sub!('?!', '2003-05-26 14:15:00 UTC') expect(out).to be_similar_to(str) end end @@ -132,22 +118,6 @@ EOS ActiveRecordData.raw_5_1_diana elsif activerecord_5_0? ActiveRecordData.raw_5_0_diana - elsif activerecord_4_2? - if RUBY_VERSION > '1.9.3' - ActiveRecordData.raw_4_2_diana - else - ActiveRecordData.raw_4_2_diana_legacy - end - elsif activerecord_4_1? - ActiveRecordData.raw_4_1_diana - elsif activerecord_4_0? - ActiveRecordData.raw_4_0_diana - elsif activerecord_3_2? - if RUBY_VERSION > '1.9.3' - ActiveRecordData.raw_3_2_diana - else - ActiveRecordData.raw_3_2_diana_legacy - end end raw_object_string.sub!('?', '1992-10-10 12:30:00') expect(out).to be_similar_to(raw_object_string) @@ -163,25 +133,10 @@ EOS ActiveRecordData.raw_5_1_multi elsif activerecord_5_0? ActiveRecordData.raw_5_0_multi - elsif activerecord_4_2? - if RUBY_VERSION > '1.9.3' - ActiveRecordData.raw_4_2_multi - else - ActiveRecordData.raw_4_2_multi_legacy - end - elsif activerecord_4_1? - ActiveRecordData.raw_4_1_multi - elsif activerecord_4_0? - ActiveRecordData.raw_4_0_multi - elsif activerecord_3_2? - if RUBY_VERSION > '1.9.3' - ActiveRecordData.raw_3_2_multi - else - ActiveRecordData.raw_3_2_multi_legacy - end end raw_object_string.sub!('?', '1992-10-10 12:30:00') raw_object_string.sub!('?', '2003-05-26 14:15:00') + expect(out).to be_similar_to(raw_object_string) end end @@ -232,20 +187,15 @@ class SubUser < User { # spec 1 out = @ap.awesome(User.methods.grep(/first/)) - if ActiveRecord::VERSION::STRING >= '3.2' - 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\)/) - else - expect(out).to match(/\sfirst\(\*arg1\)\s+Class \(ActiveRecord::Querying\)/) - end + if RUBY_VERSION >= '2.4.4' + expect(out).to match(/\sfirst\(\*arg.*?\)\s+User/) else - expect(out).to match(/\sfirst\(\*arg.*?\)\s+User \(ActiveRecord::Base\)/) + expect(out).to match(/\sfirst\(\*args,\s&block\)\s+Class \(ActiveRecord::Querying\)/) end # spec 2 out = @ap.awesome(User.methods.grep(/primary_key/)) + if RUBY_VERSION >= '2.4.4' expect(out).to match(/\sprimary_key\(.*?\)\s+User/) else @@ -255,14 +205,10 @@ class SubUser < User { # spec 3 out = @ap.awesome(User.methods.grep(/validate/)) - if ActiveRecord::VERSION::MAJOR < 3 - expect(out).to match(/\svalidate\(\*arg.*?\)\s+User \(ActiveRecord::Base\)/) + if RUBY_VERSION >= '2.4.4' + expect(out).to match(/\svalidate\(\*arg.*?\)\s+User/) else - 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\)/) - end + expect(out).to match(/\svalidate\(\*arg.*?\)\s+Class \(ActiveModel::Validations::ClassMethods\)/) end end