From 862087e8b0761ec863ce3a0ee71d090c288eb8e1 Mon Sep 17 00:00:00 2001 From: baburdick Date: Wed, 28 Nov 2018 20:30:15 -0600 Subject: [PATCH] Support upgrade to Ruby v2.3.8: skip when klass.name is nil Task 8701 --- spec/support/moribus_spec_model.rb | 10 ++++++---- tags | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/support/moribus_spec_model.rb b/spec/support/moribus_spec_model.rb index 6706545..92ad7ba 100644 --- a/spec/support/moribus_spec_model.rb +++ b/spec/support/moribus_spec_model.rb @@ -2,10 +2,12 @@ module MoribusSpecModel def self.cleanup! ObjectSpace.each_object(MoribusSpecModel) do |klass| - if Object.const_defined? klass.name.to_sym - conn, table_name = klass.connection, klass.table_name - conn.drop_table(table_name) if conn.tables.include?(table_name) - Object.send :remove_const, klass.name.to_sym + unless klass.name.nil? + if Object.const_defined? klass.name.to_sym + conn, table_name = klass.connection, klass.table_name + conn.drop_table(table_name) if conn.tables.include?(table_name) + Object.send :remove_const, klass.name.to_sym + end end end ActiveSupport::Dependencies::Reference.clear! diff --git a/tags b/tags index 9c7e0df..e2d79e8 100644 --- a/tags +++ b/tags @@ -46,7 +46,7 @@ Moribus lib/moribus/extensions/has_current_extension.rb 1;" m line:1 Moribus lib/moribus/macros.rb 1;" m line:1 Moribus lib/moribus/tracked_behavior.rb 1;" m line:1 Moribus lib/moribus/version.rb 1;" m line:1 -MoribusSpecModel spec/support/moribus_spec_model.rb 26;" f line:26 +MoribusSpecModel spec/support/moribus_spec_model.rb 28;" f line:28 MoribusSpecModel spec/support/moribus_spec_model.rb 2;" m line:2 SpecAuthor spec/moribus/alias_association_spec.rb 15;" c line:15 SpecComment spec/moribus/alias_association_spec.rb 23;" c line:23