Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
Minor simplification to cleanup_models spec helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
dkubb committed Apr 7, 2010
1 parent 21f07a4 commit e196109
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/dm-core/spec/lib/spec_helper.rb
Expand Up @@ -7,12 +7,12 @@ def self.cleanup_models
while model = descendants.shift
descendants.concat(model.descendants.to_a - [ model ])

parts = model.name.split('::')
constant_name = parts.pop.to_sym
base = parts.empty? ? Object : Object.full_const_get(parts.join('::'))
unless model.name.to_s[0] == ?#
parts = model.name.split('::')
constant_name = parts.pop.to_sym
base = parts.empty? ? Object : Object.full_const_get(parts.join('::'))

if constant_name.to_s[0] != ?# && base.const_defined?(constant_name)
base.send(:remove_const, constant_name)
base.class_eval { remove_const(constant_name) if const_defined?(constant_name) }
end

remove_ivars(model)
Expand Down

0 comments on commit e196109

Please sign in to comment.