Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use ActiveModel::TestCase base class

  • Loading branch information...
commit 38e056ee2ae97450f509348442190f21bfc45a54 1 parent f430d6b
@jeremy jeremy authored
View
6 activemodel/lib/active_model/lint.rb
@@ -1,6 +1,3 @@
-require "test/unit"
-require "test/unit/ui/console/testrunner"
-
# You can test whether an object is compliant with the ActiveModel API by
# calling ActiveModel::Lint.test(object). It will emit a Test::Unit
# output that tells you whether your object is fully compliant, or if not,
@@ -16,6 +13,9 @@
module ActiveModel
module Lint
def self.test(object, verbosity = 2, output = STDOUT)
+ require "test/unit"
+ require "test/unit/ui/console/testrunner"
+
test_class = Class.new(::Test::Unit::TestCase) do
include Test
View
4 activemodel/test/cases/lint_test.rb
@@ -1,6 +1,6 @@
require "cases/helper"
-class TestLint < Test::Unit::TestCase
+class TestLint < ActiveModel::TestCase
class CompliantObject
def to_model
self
@@ -47,4 +47,4 @@ def test_errors_aref
def test_errors_full_messages
assert_output(CompliantObject.new, 0, 0, /test_errors_aref/)
end
-end
+end
View
2  activemodel/test/cases/naming_test.rb
@@ -1,6 +1,6 @@
require 'cases/helper'
-class NamingTest < Test::Unit::TestCase
+class NamingTest < ActiveModel::TestCase
def setup
@model_name = ActiveModel::Name.new('Post::TrackBack')
end
View
2  activemodel/test/cases/validations/i18n_generate_message_validation_test.rb
@@ -3,7 +3,7 @@
require 'models/person'
-class I18nGenerateMessageValidationTest < Test::Unit::TestCase
+class I18nGenerateMessageValidationTest < ActiveModel::TestCase
def setup
Person.reset_callbacks(:validate)
@person = Person.new
Please sign in to comment.
Something went wrong with that request. Please try again.