Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't assume test superclasses are loaded.

  • Loading branch information...
commit 47a1234d17166fb739114a27d21793c47247b221 1 parent 710af14
@jbarnette authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/modelizer.rb
View
14 lib/modelizer.rb
@@ -8,6 +8,18 @@ module Modelizer
include Modelizer::Assertions
+ # Test classes that should be considered abstract when rendering
+ # tests for a model template.
+
+ TEST_CLASSES = []
+
+ %w(Test::Unit::TestCase Minitest::Unit::TestCase
+ ActiveSupport::TestCase).each do |k|
+
+ TEST_CLASSES <<
+ k.split("::").inject(Object) { |a, b| a.const_get b } rescue nil
+ end
+
@@cache = {}
def self.cache; @@cache end
@@ -104,7 +116,7 @@ def test_model_template_for_#{model}
end
END
- if [Test::Unit::TestCase, ActiveSupport::TestCase].include? self
+ if TEST_CLASSES.include? self
eval <<-END, nil, file, line - 2
class ::ModelTemplateFor#{klass}Test < ActiveSupport::TestCase
#{test}
Please sign in to comment.
Something went wrong with that request. Please try again.